Error while deleting MSSQL database from SQL management studio.

While deleting MSSQL database from SQL management studio you may receive the below error:

[wpfmb type=’error’ theme=2]The database principal owns a schema in the database, and cannot be dropped. (Microsoft SQL Server, Error: 1513[/wpfmb]

You can run the below script to get the schema details for the database.

USE Databasename;
SELECT s.name
FROM sys.schemas s
WHERE s.principal_id = USER_ID('YourUserID');

Now use the below script to alter authorization on schema which you have received from the above script

ALTER AUTHORIZATION ON SCHEMA::YourSchemaName TO dbo;

 You should now delete the database.

Leave a Reply

Your email address will not be published. Required fields are marked *