How to check active connections on your MS-SQL Database ? Print

  • 6

To check active database connection in the MS SQL server please follow the below steps.

  1. Open the SQL server management studio. Please refer to how to connect MsSQL DB using SQL management studio.

  2. Right-click on the database and click on the execute button.

  3. 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,
    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.

Was this answer helpful?

« Back