By using following syntax we could find total number of open connection in SQl server.
You could use where clause to know about specific database.
Syntax for all:
SELECT
DB_NAME(dbid) as [Database Name],
COUNT(dbid) as [Open Connections],
loginame as [Login Name]
FROM
sys.sysprocesses
WHERE
dbid > 0
GROUP BY
dbid, loginame;
For specific database:
WHERE
dbid > 0
AND DB_NAME(dbid)='your_db_name'
Tags: SQL server trick to know all open connection
You could use where clause to know about specific database.
Syntax for all:
SELECT
DB_NAME(dbid) as [Database Name],
COUNT(dbid) as [Open Connections],
loginame as [Login Name]
FROM
sys.sysprocesses
WHERE
dbid > 0
GROUP BY
dbid, loginame;
For specific database:
WHERE
dbid > 0
AND DB_NAME(dbid)='your_db_name'
Tags: SQL server trick to know all open connection