[SQL Server]The database principal owns a schema in the database, and cannot be dropped.

You are getting the below error message while performing the user drop activity with Microsoft SQL Server.

 
[Microsoft][SQL Server Native Client 11.0][SQL Server]
The database principal owns a schema in the database, and cannot be dropped. 

Some errors are captured as below,

------------------------------------------------
use SID
if (exists(select name from sys.database_principals where name = 'DBNAME' AND name != 'DBNAME'))
BEGIN
DROP SCHEMA DBNAME
DROP USER DBNAME
END
------------------------------------------------
[Microsoft][SQL Server Native Client 11.0][SQL Server]
The database principal owns a 
schema in the database, and cannot be dropped.
------------------------------------------------

Solution

Open the Microsoft SQL Server Management Studio, connect to the database. Expand the folder till Schemas.

Double click on the impacted schema. Take note of the schema owner and change it to dbo.

Now, you can proceed with the user drop.

Alternatively, you can use SQL query to perform the user drop.

DROP USER THE-ID-TO-DELETE

You May Also Like

Leave a Reply?