sql-serverdatabaseschemarolessql-drop

Dropping a role in a SQL Server database returns Error: 15138 - The database principal owns a schema int he database, and cannot be dropped


I am trying to drop one of the roles in my SQL Server database. I dropped all the members from the role and when I tried to the drop role, I got this error message:

Msg 15138, Level 16, State 1, Line 13
The database principal owns a schema in the database, and cannot be dropped.

Does anyone know why? I checked the Owned Schema and it only had check sign in its own name.


Solution

  • You cannot drop a database principal that owns a schema. You have to transfer the schema ownership to some other database principal or drop the schema before you can drop the database principal.