Technical Article

Get the all user and their server role

,

The script give you the list of all users and their respective Server role.

Use Master
GO
select su.name,p.name from sys.server_principals P 
INNER JOIN sys.server_role_members  sr
On P.principal_id = sr.role_principal_id
INNER JOIN (Select sr.Name,p.principal_id from  sys.syslogins sr INNER JOIN sys.server_principals  p
On P.sid = sr.sid)su
On sr.member_principal_id = su.principal_id

Rate

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating