See active SQL Server connections

See active SQL Server connections

To see all active connection to MSSQL database you could use below query:

Option 1: Use system store procedure:

  • EXEC sp_who   OR
  • EXEC sp_who2

Option 2: Use below query:

SELECT DB_NAME(dbid) as DBName, 
       COUNT(dbid) as NumberOfConnections, 
       loginame as LoginName 
FROM sys.sysprocesses 
WHERE dbid > 0 
GROUP BY dbid, loginame

For more information about “sp_who” command please visit this link 

Leave a Reply

Your email address will not be published. Required fields are marked *