I am trying to drop a user XYZ in SQL server. Keeps getting an erro saying drop failed

Miller, Zafar 0 Reputation points
2026-09-04T17:44:03.36+00:00

I am trying to drop a user XYZ in SQL server. Keeps getting an erro saying drop failed msg says cannot dropt the user dbo Microsoft sql erver smo. I must be missing something.

SQL Server | Other
SQL Server | Other

Additional SQL Server features and topics not covered by specific categories


1 answer

Sort by: Newest
  1. Dan Guzman 9,521 Reputation points
    2026-09-04T19:57:21.48+00:00

    The error may be a symptom of a mismatch between the dbo user within the database and the database owner recorded in sys.databases. Run the query below to see if the owner names are different:

    USE YourDatabase;

    SELECT

    SUSER_SNAME(dp.sid) AS DboUserOwner

    , SUSER_SNAME(d.owner_sid) LoginOwner

    FROM sys.database_principals AS dp

    JOIN sys.databases AS d ON d.name = DB_NAME()

    WHERE dp.name = N'dbo';

    To correct the problem, change the owner to a login which does not currently exist as a database user:

    ALTER AUTHORIZATION ON DATABASE::YourDatabase TO SomeOtherLogin;

    You should then be able to drop the XYZ user from the database.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.