How to drop a SQL Server user with db owner privilege

I had the same problem, I run two scripts then my problem is solved.

Try this:

In this query you can get user schema as a result for AdventureWorks database:

USE AdventureWorks;
SELECT s.name
FROM sys.schemas s
WHERE s.principal_id = USER_ID('your username');

after take schema name you can alter authorization on schema like this:

ALTER AUTHORIZATION ON SCHEMA::db_owner TO dbo;

in this query db_owner schema name that get from first query.

finally you can delete user without error.

my source: SQL SERVER – Fix: Error: 15138

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)