TSQL Event Classes

Administering SQL Server

Administering SQL Server

TSQL Event Classes

The following table describes the TSQL event classes in the TSQL event category.

Event class Description
Exec Prepared SQL Indicates when a prepared SQL statement or statements have been executed by ODBC, OLEDB, or DB-Library.
Prepare SQL Indicates when an SQL statement or statements have been prepared for use by ODBC, OLEDB, or DB-Library.
SQL:BatchCompleted Transact-SQL batch has completed.
SQL:BatchStarting Transact-SQL batch has started.
SQL:StmtCompleted Transact-SQL statement has completed.
SQL:StmtStarting Transact-SQL statement has started.
Unprepare SQL Indicates when a prepared SQL statement or statements have been unprepared by ODBC, OLEDB, or DB-Library.

By monitoring the TSQL event classes and monitoring the events using single stepping, you can monitor your application queries. The SQL:BatchStarting event class will show the Transact-SQL submitted in a batch, while the SQL:StmtStarting event class shows the individual statement within a batch. By replaying the SQL:BatchCompleted event class, any results returned by the batch are displayed and can be checked to ensure they match the expected results.

Monitoring the Start Time, End Time, and Duration default data columns reveals when the events start and complete, and how long each remote procedure call (RPC), batch, or statement takes to complete. By grouping events based on the Duration default data column, you can easily determine the longest running queries. Monitoring the NT User Name and DBUserName default data columns can also identify users who submit these queries.

See Also

TSQL Event Category

TSQL Data Columns