SQL Server Security – Common Questions Answered

Securitysql server

Hello guys I have a question

I have a group in that group a user shouldn't have syadmin permissions but he must be on that group.

He has his login map by the group and his windows login on sql server

Is it possible to deny him the server role syadmin but remain on the public role while still remain on the group?

Thanks in advance for the help.

Best Answer

Removing a principal from sysadmin role does not remove the principal from public role. You cannot use deny on members of sysadmin role or the object owners. Using sp_dropsrvrolemember system stored procedure to remove the principal from sysadmin role should be your solution. If somebody does not belong to the party, better kick him out. Remember you need to be sysadmin yourself if you want to remove another principal from sysadmin role.

EXEC master..sp_dropsrvrolemember [user], 'sysadmin';
go