Find User Connection Count
-
Posted on May 31, 2009 by Derek Dieter
-
0
[cc lang=”sql”]
— Show users with highest connections
SELECT login_name, session_count, last_batch_time
FROM(
SELECT login_name ,COUNT(session_id) AS session_count, MAX(last_request_end_time) AS last_batch_time
FROM sys.dm_exec_sessions
GROUP BY login_name
) t
ORDER BY session_count DESC
[/cc]
In SQL Server 2008 you can also find out how many connections have been created to SQL Server since the last time it got restarted:
[cc lang=”sql”]
SELECT @@Connections
[/cc]
Post a comment
- Comments (RSS)
- Trackback
- Permalink