The following are the steps to check the active database connection in the MS SQL Server. Please follow the steps below.

Step 1: Open the SQL Server Management Studio.

Step 2: Right-click on the database on which you want to check the active connection and click on the execute button.

Step 3: Run the script below.


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 find the result in tabular format with the connections to each database.

Was this answer helpful? 0 Users Found This Useful (0 Votes)