Snippets

Ricardo Chu SQL Server connections

Created by Ricardo Chu
/*
List databases and the number of connections to the database.
*/

SELECT
    HOSTNAME,
    DB_NAME( dbid) as DBName ,
    COUNT( dbid) as NumberOfConnections ,
    loginame as LoginName
FROM
    sys.sysprocesses
WHERE
    dbid > 0
GROUP BY
    hostname,dbid, loginame;

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.