My SQL Server Profiler doesn't seem to be correctly processing SQL:StmtCompleted events. SQL Server Books Online (BOL) says that SQL:StmtCompleted will capture SQL statements as they execute within the body of a stored procedure. However, my system isn't capturing SQL statements within a procedure. What's wrong?
The behavior of SQL Server 2000's SQL:StmtCompleted event changed when Microsoft released Service Pack 1 (SP1). Without SP1, the SQL:StmtCompleted event captures execution of SQL statements within a procedure, and you don't need to set the SP:StmtCompleted event. SQL Server 2000 SP1 and later requires you to set the SP:StmtCompleted event to capture the execution of individual statements within a procedure, and the SQL:StmtCompleted event no longer captures execution of statements within a procedure. For a complete explanation of this change, see the Microsoft article "FIX: Incorrect Behavior in SQL Server Profiler Event Generation" at http://support.microsoft.com/default.aspx?scid=kb;en-us;q286119. Also, the updated version of BOL, which is available at http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp, correctly says that in SQL Server 2000 SP1 and later, you have to set SP:StmtCompleted to capture events within a procedure.