SQL SERVER – How to See Active SQL Server Connections For Database

Another question received via email –

“How do I I know which user is connected to my database with how many connection?”

Here is the script which will give us answer to the question.

SELECT DB_NAME(dbid) AS DBName,
COUNT(dbid) AS NumberOfConnections,
loginame
FROM    sys.sysprocesses
GROUP BY dbid, loginame
ORDER BY DB_NAME(dbid)

Here is the resultset:

SQL SERVER - How to See Active SQL Server Connections For Database connectiondb

Reference: Pinal Dave (https://darkslategrey-bat-805937.hostingersite.com)

SQL DMV
Previous Post
SQL SERVER – How to Force New Cardinality Estimation or Old Cardinality Estimation
Next Post
SQL Authority News – Secret Tool Box of Successful Bloggers: 52 Tips to Build a High Traffic Top Ranking Blog

Related Posts

Leave a Reply