Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

How to: Modify an Existing Trace (Transact-SQL)

This topic describes how to use stored procedures to modify an existing trace.

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

  2. To modify trace events, execute sp_trace_setevent by specifying the changes through the parameters. Listed in order, the parameters are:

    • @traceid (Trace ID)
    • @eventid (Event ID)
    • @columnid (Column ID)
    • @on (ON)

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

    ON Column ID Result

    ON (1)


    Event is turned on. All columns are cleared.



    Column is turned on for the specified event.

    OFF (0)


    Event is turned off. All columns are cleared.



    Column is turned off for the specified event.

Unlike regular stored procedures, parameters of all SQL Server 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 returns an error.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2014 Microsoft. All rights reserved.