Thursday, January 5, 2017

SQL Server: Database principal owns a schema in the database and cannot be dropped

Got this error today when i was playing around with login and user created selecting different options.

I had check db_datareader and db_datawriter in OwnedSchemas tab in Security >> Logins of the database server. This was causing the error and the fix was to transfer the schema ownership to a different login so we can drop the user we were trying to.

ALTER AUTHORIZATION ON SCHEMA::db_datareader to whome;
ALTER AUTHORIZATION ON SCHEMA::db_datawriter to whome;

Hope this helps someone and Google is my friend 😎

No comments:

Post a Comment