How to List Sysadmins in Microsoft SQL Server

Microsoft SQL Server

Sometimes I need to know who has system administrator privileges in Microsoft SQL Server. Here’s a SQL snippet to list the sysadmins.

Listing Sysadmins in MSSQL

SELECT [name] FROM sys.syslogins
WHERE sysadmin=1 AND (isntuser=1 OR isntgroup=1);

Output

You should see something similar to this in response (depending on your version of Windows, SQL Server, and any changes you have made):

[name]
NT AUTHORITY\SYSTEM
NT SERVICE\MSSQL$SQLEXPRESS
NT AUTHORITY\NETWORK SERVICE

Have fun!