Advertisement
willianto

Shows info about all active user connections

Nov 7th, 2016
295
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
T-SQL 0.32 KB | None | 0 0
  1. SELECT s.*  
  2. FROM sys.dm_exec_sessions AS s  
  3. WHERE EXISTS  
  4.     (  
  5.     SELECT *  
  6.     FROM sys.dm_tran_session_transactions AS t  
  7.     WHERE t.session_id = s.session_id  
  8.     )  
  9.     AND NOT EXISTS  
  10.     (  
  11.     SELECT *  
  12.     FROM sys.dm_exec_requests AS r  
  13.     WHERE r.session_id = s.session_id  
  14.     );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement