FIX: Incorrect Behavior in SQL Profiler Event Generation

This article was previously published under Q286119
This article has been archived. It is offered "as is" and will no longer be updated.
BUG #: 234705 (SHILOH_BUGS)
There is a specific change in SQL Profiler in SQL Server 2000 from SQL Server 7.0 in regards to the events that are captured. The specific changes are outlined in the "More Information" section of this article.
To resolve this problem, obtain the latest service pack for SQL Server 2000. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:
290211 INF: How to Obtain the Latest SQL Server 2000 Service Pack
Microsoft has confirmed that this is a problem in SQL Server 2000.
This problem was first corrected in SQL Server 2000 Service Pack 1.
In SQL Server 7.0, SQL:StmtStarting and SQL:StmtCompleted events display all ad-hoc queries and executed stored procedure events. SP:StmtStarting and SP:StmtCompleted events display all statements within a stored procedure.

Starting in SQL Server 2000, SQL:StmtStarting and SQL:StmtCompleted events display not only the execution of a stored procedure but all the statements within the stored procedure. Due to this change in behavior, the capability of controlling the granularity of information being captured is lost.

This behavior has been changed in SQL Server 2000 Service Pack 1 and the SQL Server 7.0 behavior is restored. You can now capture the individual statements within a stored procedure by using SP:StmtStarting and SP:StmtCompleted events because the statements are no longer mapped to SQL:StmtStarting and SQL:StmtCompleted events.

If you are using T-SQL to access or capture trace data, the StmtCompleted events have the event class numbers specified below if Service Pack 1 has been applied to the server. These are the numbers that you should include to capture these events in a trace (sp_trace_setevent) or search for these events in a trace table or fn_trace_gettable output.
   Event Name            Event Number   --------------------- ------------   SP:StmtCompleted      45   SQL:StmtCompleted     41				

Article ID: 286119 - Last Review: 01/16/2015 21:27:18 - Revision: 4.2

  • Microsoft SQL Server 2000 Standard Edition
  • kbnosurvey kbarchive kbbug kbfix kbsqlserv2000sp1fix KB286119