How to modify an existing trace (Transact-SQL)

How to Install SQL Server 2000

How To

How to modify an existing trace (Transact-SQL)

To modify an existing trace

  1. If the trace is already running, execute sp_trace_setstatus specifying @status = 0 to stop the trace.

  2. To modify trace events, execute sp_trace_setevent, specifying the changes through the parameters. Listed in order, they are:
    • @traceid (Trace ID)

    • @eventid (Event ID)

    • @columnid (Column ID)

    • @on (ON)

    When modifying the @on parameter, keep in mind its interaction with the @columnid parameter:

    ON Column ID Result
    ON (1) NULL Event is turned on.
    All columns are cleared.
      NOT NULL Column is turned on for the specified event.
    OFF (0) NULL Event is turned off.
    All columns are cleared.
      NOT NULL Column is turned off for the specified event.

    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

Modifying Templates

sp_trace_setevent

System Stored Procedures (SQL Profiler Procedures)