daily pastebin goal
33%
SHARE
TWEET

Untitled

a guest Jul 11th, 2018 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT session_id, client_net_address
  2.     FROM sys.dm_exec_connections
  3.    
  4. -- Get a count of SQL connections by IP address
  5. SELECT ec.client_net_address, es.[program_name],
  6. es.[host_name], es.login_name,
  7. COUNT(ec.session_id) AS [connection count]
  8. FROM sys.dm_exec_sessions AS es  
  9. INNER JOIN sys.dm_exec_connections AS ec  
  10. ON es.session_id = ec.session_id  
  11. GROUP BY ec.client_net_address, es.[program_name], es.[host_name], es.login_name  
  12. ORDER BY ec.client_net_address, es.[program_name];
  13.  
  14. -- Get a count of SQL connections by login_name
  15. SELECT login_name, COUNT(session_id) AS [session_count]
  16. FROM  sys.dm_exec_sessions
  17. GROUP BY login_name
  18. ORDER BY login_name;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top