How to find users with sysadmin role in SQL Server

The below script can be used to find out the users with sysadmin role in SQL Server.

SELECT     AS LoginName,
       type_desc   AS LoginType,
       Cast(create_date AS DATE) DateCreated
FROM   sys.server_principals SP
inner join sys.syslogins SL
on SP.sid=SL.sid
WHERE SL.sysadmin=1

1 comment:

  1. Through this post, I know that your good knowledge in playing with all the pieces was very helpful. I notify that this is the first place where I find issues I've been searching for. You have a clever yet attractive way of writing on Msbi online training
    Msbi online training Hyderabad
    Msbi online training India
    Msbi online course
    Msbi training online