Tuesday, August 26, 2014

How to check Active SQL Server Connections For Database

“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(dbidAS DBName,COUNT(dbidAS NumberOfConnections,loginameFROM    sys.sysprocessesGROUP BY dbidloginameORDER BY DB_NAME(dbid)
Here is the resultset:

No comments:

Post a Comment