/ Published in: SQL
Identify last statement run for a specific SQL Server session
Written By: Tim Ford -- 7/22/2009
Written By: Tim Ford -- 7/22/2009
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
SELECT DEST.TEXT FROM sys.[dm_exec_connections] SDEC CROSS APPLY sys.[dm_exec_sql_text](SDEC.[most_recent_sql_handle]) AS DEST WHERE SDEC.[most_recent_session_id] = @PID
URL: http://www.mssqltips.com/tip.asp?tip=1799