Tuesday, February 21, 2012

List SQL active connection

Good script:
SELECT db_name(dbid) as DatabaseName, count(dbid) as NoOfConnections,
loginame as LoginName
FROM sys.sysprocesses
WHERE dbid > 0
GROUP BY dbid, loginame

The script can enumerate all databases on a SQL 2005-2008 r2 server and list active connection.

FROM:  http://www.sqlservercurry.com/2008/03/how-to-see-active-connections-for-each.html

No comments:

Post a Comment