When diagnosing a problem, you may want to know what statement was executing when the problem occurred. The sp_iqcontext stored procedure tells you what statements are running on the system when you run the procedure, 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 SQL log, as well as stack traces, to determine what was happening when a problem occurred.
For details and sample output, see “sp_iqcontext procedure” in Chapter 7, “System Procedures,” of Reference: Building Blocks, Tables, and Procedures. To match .iqmsg log and the -zr SQL log entries using connection information, see “Correlating connection information”.