Share via

Unable to delete the login in SQL Server

2022-07-14T09:48:35.28+00:00

Error :

Msg 15141, Level 16, State 1, Line 1
The server principal owns one or more server role(s) and cannot be dropped.

Note: I don't have always on or any mirroring endpoints, the server is simple and standalone.

is there any way to drop the login.

SQL Server | Other
SQL Server | Other

Additional SQL Server features and topics not covered by specific categories


4 answers

Sort by: Most helpful
  1. Olaf Helper 47,616 Reputation points
    2022-07-15T08:52:23.07+00:00

    It does not have any roles

    You misunderstood; the login owns (!) a server role.

    Was this answer helpful?


  2. YufeiShao-msft 7,156 Reputation points
    2022-07-15T08:48:20.127+00:00

    HI @Anonymous ,

    You can use the following code to check the server role, if you use Windows Groups for this login

    select @@SERVERNAME  
    ,sl.name  
    ,isnull(DB_Roles.Roles,'Public')   
    from syslogins sl  
    left join  
    (  
    select 'sysadmin' as Roles  
    union all   
    select 'securityadmin'   
    union all   
    select 'serveradmin'   
    union all   
    select 'setupadmin'   
    union all   
    select 'processadmin'   
    union all   
    select 'diskadmin'   
    union all   
    select 'dbcreator'   
    union all   
    select 'bulkadmin'   
    union all   
    select 'No serverRole'   
    union all  
    select 'public'  
    ) DB_Roles   
    on   
    Case When sl.sysadmin=1 and DB_Roles.Roles='sysadmin' then 'sysadmin'   
    	When sl.securityadmin=1 and DB_Roles.Roles='securityadmin' then 'securityadmin'  
    	When sl.serveradmin=1 and DB_Roles.Roles='serveradmin' then 'serveradmin'   
    	When sl.setupadmin=1 and DB_Roles.Roles='setupadmin' then 'setupadmin'   
    	When sl.processadmin=1 and DB_Roles.Roles='processadmin' then 'processadmin'   
    	When sl.diskadmin=1 and DB_Roles.Roles='diskadmin' then 'diskadmin'   
    	When sl.dbcreator=1 and DB_Roles.Roles='dbcreator' then 'dbcreator'    
    	When sl.bulkadmin=1 and DB_Roles.Roles='bulkadmin' then 'bulkadmin'   
    	else null end=DB_Roles.Roles  
    	  
    order by 2  
    

    -------------

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Was this answer helpful?

    0 comments No comments

  3. Doddasiddavannahally, Pradyothana 41 Reputation points
    2022-07-14T12:16:52.077+00:00

    Hello,
    It does not have any roles

    220739-image.png

    Was this answer helpful?

    0 comments No comments

  4. Olaf Helper 47,616 Reputation points
    2022-07-14T10:02:47.567+00:00

    The server principal owns one or more server role(s) and cannot be dropped.

    Read the error message.
    The login owns server roles. Change the role(s) owner to a different login before you can drop the login.

    Was this answer helpful?

    0 comments No comments

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.