Created
March 8, 2015 18:18
-
-
Save duyet/f0d00fc6af9d8d88c213 to your computer and use it in GitHub Desktop.
Load history of SQL Exec
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT conn.session_id, sson.host_name, sson.login_name, | |
sqltxt.text, sson.login_time, sson.status | |
FROM sys.dm_exec_connections conn | |
INNER JOIN sys.dm_exec_sessions sson | |
ON conn.session_id = sson.session_id | |
CROSS APPLY sys.dm_exec_sql_text(most_recent_sql_handle) AS sqltxt | |
ORDER BY conn.session_id |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment