Skip to content

Latest commit

 

History

History
53 lines (40 loc) · 2.54 KB

File metadata and controls

53 lines (40 loc) · 2.54 KB
description Modify an Existing Trace (Transact-SQL)
title Modify an Existing Trace (Transact-SQL) | Microsoft Docs
ms.custom
ms.date 03/06/2017
ms.service sql
ms.reviewer
ms.subservice
ms.topic conceptual
helpviewer_keywords
traces [SQL Server], modifying
modifying traces
ms.assetid 8792b43f-2510-44e3-9239-e73ad8227b89
author MashaMSFT
ms.author mathoma

Modify an Existing Trace (Transact-SQL)

[!INCLUDE SQL Server] This topic describes how to use stored procedures to modify an existing trace.

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) 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 [!INCLUDEssSqlProfiler] 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.

See Also

sp_trace_setevent (Transact-SQL)
sp_trace_setstatus (Transact-SQL)
System Stored Procedures (Transact-SQL)
SQL Server Profiler Stored Procedures (Transact-SQL)