Introducing SQL Trace
Microsoft SQL Server provides Transact-SQL system stored procedures to create traces on an instance of the SQL Server Database Engine. These system stored procedures can be used from within your own applications to create traces manually, instead of using SQL Server Profiler. This allows you to write custom applications specific to the needs of your enterprise.
In This Section
Topic |
Description |
---|---|
Contains a glossary of terms used to discuss SQL Trace. |
|
Contains a diagram that illustrates how SQL Trace works in SQL Server. |
|
Contains information about using SQL Trace. For example, the topics in this section describe how to create trace filters and saving a trace. |
The following table lists the system stored procedures for tracing an instance of the SQL Server Database Engine.
Stored procedure |
Task performed |
---|---|
Returns information about events included in a trace. |
|
Returns information about a specified trace or all existing traces. |
|
Creates a trace definition. The new trace will be in a stopped state. |
|
Creates a user-defined event. |
|
Adds an event class or data column to a trace, or removes one from it. |
|
Starts, stops, or closes a trace. |
|
Returns information about filters applied to a trace. |
|
Applies a new or modified filter to a trace. |
To define your own trace using stored procedures
Specify the events to capture using sp_trace_setevent.
Specify any event filters. For more information, see How to: Set a Trace Filter (Transact-SQL).
Specify the destination for the captured event data using sp_trace_create.
For an example of using trace stored procedures, see How to: Create a Trace (Transact-SQL).
To set trace definition defaults
To set trace display defaults