April 15, 2015 at 2:12 pm
Hi,
I am trying to drop users from a specific database and getting the error below . Please help.
TITLE: Microsoft SQL Server Management Studio
------------------------------
Drop failed for User 'User1'. (Microsoft.SqlServer.Smo)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=11.0.5058.0+((SQL11_PCU_Main).140514-1820+)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Drop+User&LinkId=20476
------------------------------
ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
------------------------------
The database principal owns a schema in the database, and cannot be dropped. (Microsoft SQL Server, Error: 15138)
April 15, 2015 at 2:15 pm
PSB (4/15/2015)
Hi,I am trying to drop users from a specific database and getting the error below . Please help.
TITLE: Microsoft SQL Server Management Studio
------------------------------
Drop failed for User 'User1'. (Microsoft.SqlServer.Smo)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=11.0.5058.0+((SQL11_PCU_Main).140514-1820+)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Drop+User&LinkId=20476
------------------------------
ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
------------------------------
The database principal owns a schema in the database, and cannot be dropped. (Microsoft SQL Server, Error: 15138)
The answer is in the error message:
The database principal owns a schema in the database, and cannot be dropped. (Microsoft SQL Server, Error: 15138)
The user you are trying to drop owns a schema in the database. You need to reassign the ownership of this schema to a different user before you can drop the user.
December 22, 2015 at 11:19 pm
SELECT s.name
FROM sys.schemas s
WHERE s.principal_id = USER_ID(‘TestUser’)
ALTER AUTHORIZATION ON SCHEMA::SchemaName TO dbo
GO
DROP USER TestUser
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy