How to create a trace (Transact-SQL)

How to Install SQL Server 2000

How To

How to create a trace (Transact-SQL)

To create a trace

  1. Execute sp_trace_create with the required parameters to create a new trace. The new trace will be in a stopped state (status is 0).

  2. Execute sp_trace_setevent with the required parameters to select the events and columns to trace.

  3. Optionally, execute sp_trace_setfilter to set any or a combination of filters.

    sp_trace_setevent and sp_trace_setfilter can be executed only on existing traces that are stopped.

    Important  Unlike regular stored procedures, parameters of all SQL Profiler stored procedures (sp_trace_xx) are strictly typed and do not support automatic data type conversion. If these parameters are not called with the correct input parameter data types, as specified in the argument description, the stored procedure will return an error.

See Also

Creating and Managing Traces and Templates

sp_trace_create

sp_trace_setevent