To check active database connection in the MS SQL server please follow the below steps.
- Open the SQL server management studio. Please refer to how to connect MsSQL DB using SQL management studio.
- Right-click on the database and click on the execute button.
- Now, run the below select query to find our active connection on your database. Here, you need to add your database name instead of DB NAME.
SELECT DB_NAME(dbid) AS DBName, COUNT(dbid) AS NumberOfConnections, loginame FROM sys.sysprocesses GROUP BY dbid, loginame ORDER BY DB_NAME(dbid)
You will see the result similar to below screen capture, it will show all the active database connection on your SQL server.
To check the active sessions/connection in the SQL server execute the below query in the SQL server management studio.
exec sp_who
The above query will show all the active users and sessions connected to the SQL server.