Find User Connection Count

[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]

Featured Articles

 Site Author

  • Thanks for visiting!
css.php