FIX: Incorrect Behavior in SQL Profiler Event Generation (286119)



The information in this article applies to:

  • Microsoft SQL Server 2000 (all editions)

This article was previously published under Q286119
BUG #: 234705 (SHILOH_BUGS)

SYMPTOMS

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.

RESOLUTION

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

STATUS

Microsoft has confirmed that this is a problem in SQL Server 2000.
This problem was first corrected in SQL Server 2000 Service Pack 1.

MORE INFORMATION

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
				

Modification Type:MajorLast Reviewed:10/17/2003
Keywords:kbBug kbfix kbSQLServ2000sp1fix KB286119