Last statement run for a specific SQL Server session


/ Published in: SQL
Save to your folder(s)

Identify last statement run for a specific SQL Server session
Written By: Tim Ford -- 7/22/2009


Copy this code and paste it in your HTML
  1. SELECT DEST.TEXT
  2. FROM sys.[dm_exec_connections] SDEC
  3. CROSS APPLY sys.[dm_exec_sql_text](SDEC.[most_recent_sql_handle]) AS DEST
  4. WHERE SDEC.[most_recent_session_id] = @PID

URL: http://www.mssqltips.com/tip.asp?tip=1799

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.