Hi,
When you are trying to remove user from a database, you will get:
The database
principal owns a schema in the database, and cannot be dropped. (Microsoft SQL
Server, Error: 15138)
principal owns a schema in the database, and cannot be dropped. (Microsoft SQL
Server, Error: 15138)
There is a easy fix for this.
First see what Schemas the user principal own’s:
USE
DATABASENAME;
DATABASENAME;
SELECT
s.name
s.name
FROM
sys.schemas s
sys.schemas s
WHERE
s.principal_id =
USER_ID(‘domainusername’);
s.principal_id =
USER_ID(‘domainusername’);
Then use that database to the following query:
ALTER AUTHORIZATION ON SCHEMA::db_owner TO db_owner;
Now you can delete the user and add it again.