|
|
|
Say Hey Kid
      
Group: General Forum Members
Last Login: Wednesday, May 01, 2013 5:17 PM
Points: 701,
Visits: 207
|
|
|
|
|
|
Old Hand
      
Group: General Forum Members
Last Login: Yesterday @ 2:59 PM
Points: 382,
Visits: 1,104
|
|
|
|
|
|
Old Hand
      
Group: General Forum Members
Last Login: Today @ 2:20 PM
Points: 306,
Visits: 1,014
|
|
Hello,
Congrats on the great script. Very useful!
I have added below a script that would be a great addition to your code. It produces the IP address of the workstation connected. I found it at SQL Central. It would helpful if the user is connected with SQL authentication.
What do you think?
Rudy
SELECT ec.client_net_address AS 'IP Address of Client', es.[program_name] AS 'Name of Application', es.[host_name] AS 'Host/Computer Name', es.login_name AS 'ID Used', COUNT(ec.session_id) AS 'Connection Count', @@SERVICENAME AS 'Instance User Is Connected To' FROM sys.dm_exec_sessions AS es INNER JOIN sys.dm_exec_connections AS ec ON es.session_id = ec.session_id GROUP BY ec.client_net_address, es.[program_name], es.[host_name], es.login_name ORDER BY ec.client_net_address, es.[program_name]
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Tuesday, December 27, 2011 5:09 AM
Points: 1,
Visits: 17
|
|
Due to the use of Cross Apply, this will only return rows where the Statement and QueryPlans are available. Change it to an OUTER APPLY to gather all spids.
ie
OUTER APPLY sys.dm_exec_sql_text(sql_handle) AS Statements OUTER APPLY sys.dm_exec_query_plan(plan_handle) AS QueryPlans
|
|
|
|