Check the entire active connections of MSSQL database

kumkumsharma

Administrator
Staff member
You can follow below steps to check the active connections of MSSQL database.
  • Login to Windows server.
  • Open SQL Management studio.
  • Here right click on particular database and click on execute.
  • Now you have to run the select query to check active database connection.
Code:
SELECT DB_NAME(dbid) AS DBName,
COUNT(dbid) AS NumberOfConnections,
loginame
FROM sys.sysprocesses
GROUP BY dbid, loginame
ORDER BY DB_NAME(dbid)
Here you have to use DBName as your database name.

Now you will able to see the list of all the active database connections.

You can run below command if you want to check active sessions in SQL server management studio.

Code:
exec sp_who
Result will display all the active users and sessions with SQL server.
 
Top