Skip to content

Instantly share code, notes, and snippets.

@rajanand
Created June 9, 2014 17:13
Show Gist options
  • Save rajanand/6ac8abd3acd2a09e1bdd to your computer and use it in GitHub Desktop.
Save rajanand/6ac8abd3acd2a09e1bdd to your computer and use it in GitHub Desktop.
To find the number of active connections for each database in sql server.
--To find the no. of active connections in sql server
SELECT db_name(dbid) as database_name, loginame, count(dbid) as no_of_connections
FROM sys.sysprocesses
WHERE spid > 50
GROUP BY dbid, loginame
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment