Skip to content

Instantly share code, notes, and snippets.

@SteGriff
Created June 7, 2021 09:24
Show Gist options
  • Save SteGriff/02505ac25f7dd544efd2afed61d9e05f to your computer and use it in GitHub Desktop.
Save SteGriff/02505ac25f7dd544efd2afed61d9e05f to your computer and use it in GitHub Desktop.
SQL connections
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