Error – SQL server error with drop user

n this Article I am depicting one of one of a kind mistake – "Login 'x' claims at least one database(s). Change the proprietor of the database(s) before dropping the login". which, I have looked in genuine situation issue when I was doing drop client on Clint server.

Notwithstanding, Above blunder was coming when run this question in T-SQL

 USE [master]  
DROP LOGIN [Username]  

A similar error will appear if we try to drop it using the SSMS

For this error solution firstly checked database mapping using below query 

 SELECT name, suser_sname(owner_sid) AS DBOwner FROM sys. databases   
This query showed me one of the database is mapped this user.

In order to I decided to change database owner for solution so I run this below query for change database ownership. 

 USE SQLDBALogicsPractice   
sp_changedbowner 'sa' 

after change ownership this issue has been resolved. Now I am able to drop that user.

Leave a Reply

Your email address will not be published. Required fields are marked *