Posts
26
Comments
39
Trackbacks
0
SQL server - get list of active connections to each database
Many times, we want list of all users who are connected to the SQL server - to determine it  use the below query. It returns the Database, Number of open connections and logged-in user credentials.

SELECT DB_NAME(dbid) as Database, COUNT(dbid) as Number Of Open Connections,
loginame as LoginName
FROM sys.sysprocesses
WHERE dbid > 0
GROUP BY dbid, loginame

Hope this helps.
posted on Monday, March 4, 2013 3:24 PM Print
Comments
No comments posted yet.

Post Comment

Title *
Name *
Email
Comment *