Tuesday, January 9, 2018

The database principal owns a schema in the database, and cannot be dropped

SQL Error: "The database principal owns a schema in the database, and cannot be dropped" To fix the issue, we need to find out the userId is owned which schema(s).
SELECT name FROM sys.schemas WHERE principal_id = USER_ID('theUserName')

Then you can assign the schema(s) to dbo to release the user from owning them.
ALTER AUTHORIZATION ON SCHEMA::SchemaName TO dbo


Share/Bookmark

No comments: