SQLServer查看用户连接数
SELECT login_name, Count(0) user_count FROM Sys.dm_exec_requests dr WITH(nolock) RIGHT OUTER JOIN Sys.dm_exec_sessions ds WITH(nolock) ON dr.session_id = ds.session_id RIGHT OUTER JOIN Sys.dm_exec_connections dc WITH(nolock) ON ds.session_id = dc.session_id WHERE ds.session_id > 50 GROUP BY login_name ORDER BY user_count DESC