15138: The database principal owns a schema in the database, and cannot be dropped
SQL ServerWhat does it mean?
An attempt was made to drop a database user/role (database principal), but it could not be dropped because the principal owns one or more schemas in the database. It cannot be dropped until the schemas it owns are transferred to another principal.
Why does it happen?
The user being removed is the OWNER of at least one schema (e.g., a schema created with its own name by default, or one assigned via AUTHORIZATION). SQL Server blocks the drop to avoid leaving orphaned schemas.
How to fix it
Find the schemas owned by the user: SELECT name FROM sys.schemas WHERE principal_id = USER_ID('app_user'); Transfer ownership of these schemas to another principal (e.g., dbo): ALTER AUTHORIZATION ON SCHEMA::[app_schema] TO dbo; If the schema is no longer needed (and is empty), DROP SCHEMA. After ownership has been transferred, run DROP USER again.
More from this engine
- 8651Could not perform the operation because the requested memory grant was not available
- 5061ALTER DATABASE failed because a lock could not be placed on database
- 3702Cannot drop database because it is currently in use
- 1934INSERT/UPDATE failed because the following SET options have incorrect settings
- 468Cannot resolve the collation conflict
- 4864Bulk load data conversion error (type mismatch or invalid character)
- 916The server principal is not able to access the database under the current security context