Monday, April 16, 2012

Get SQL users that are connected and how many sessions they have

-- Get SQL users that are connected and how many sessions they have
SELECT login_name ,
COUNT(session_id) AS [session_count]
FROM sys.dm_exec_sessions
GROUP BY login_name
ORDER BY COUNT(session_id) DESC ;

No comments:

Post a Comment