How can one figure out what was the last SQL Statement executed in sessions.
SELECT session_id, TEXT
The query for this is very simple. It uses two DMVs and created following quick script for the same.
FROM sys.dm_exec_connections
CROSS APPLY sys.dm_exec_sql_text(most_recent_sql_handle) AS ST
No comments:
Post a Comment