How to check opened connection in sql server
Sometimes we need to know how many database connections are opened in sql server. So here is the code snippet that we can use to get number of opened connection per database.
SELECT
[DATABASE] = DB_NAME(DBID),
OPNEDCONNECTIONS =COUNT(DBID),
[USER] =LOGINAME
FROM SYS.SYSPROCESSES
GROUP BY DBID, LOGINAME
ORDER BY DB_NAME(DBID), LOGINAME
When you run above code you will get result something like below.
Enjoy reading...