Examples of getting the query text by SESSIONID - MSSQL
Examples of getting the query text by session identifier DECLARE @sqltext VARBINARY(128) SELECT @sqltext = sql_handle FROM sys.sysprocesses WHERE spid = (YourSessionID) SELECT TEXT FROM sys.dm_exec_sql_text(@sqltext) GO SELECT TEXT FROM sy…