Created
October 31, 2013 16:32
-
-
Save nickfloyd/7252767 to your computer and use it in GitHub Desktop.
SQL that returns number of connections per database grouped by login
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
DB_NAME(dbid) as DBName, | |
COUNT(dbid) as NumberOfConnections, | |
loginame as LoginName | |
FROM | |
sys.sysprocesses | |
WHERE | |
dbid > 0 | |
GROUP BY | |
dbid, loginame |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment