Search

Thursday, August 4, 2011

Get Query Running in Session

Run the following query to find out what the latest query that was executed in the session.

DECLARE @sqltext VARBINARY(128)
SELECT @sqltext = sql_handle
FROM sys.sysprocesses
WHERE spid = (YourSessionID)
SELECT TEXT
FROM sys.dm_exec_sql_text(@sqltext)
GO





No comments:

Post a Comment