Finding the Currently Executing Statement

When diagnosing a problem, you may want to know what statement was executing when the problem occurred.

The sp_iqcontext stored procedure lists currently running statements, and identifies the user and connection that issued the statement. You can use this utility together with information provided by sp_iqconnection, the .iqmsg log, and the -zr server request log (.srvlog), as well as stack traces, to determine what was happening when a problem occurred.

To match .iqmsg log and the -zr server request log entries using connection information, correlate connection information between the .srvlog and .iqmsg files.