Skip to content

Latest commit

 

History

History
35 lines (27 loc) · 1.79 KB

set-a-trace-filter-transact-sql.md

File metadata and controls

35 lines (27 loc) · 1.79 KB
title description author ms.author ms.reviewer ms.date ms.service ms.topic helpviewer_keywords
Set a trace filter (Transact-SQL)
Learn how to use stored procedures to create a filter that retrieves only the information you need on an event being traced.
MashaMSFT
mathoma
randolphwest
07/17/2024
sql
language-reference
filters [SQL Server], traces
traces [SQL Server], filters

Set a trace filter (Transact-SQL)

[!INCLUDE SQL Server]

This article describes how to use stored procedures to create a filter that retrieves only the information you need on an event being traced.

Set a trace filter

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

  2. Execute sp_trace_setfilter to configure the type of information to retrieve for the event being traced.

Important

Unlike regular stored procedures, parameters of all [!INCLUDE ssSqlProfiler] stored procedures (sp_trace_*) are strictly typed and don't support automatic data type conversion. If these parameters aren't called with the correct input parameter data types, as specified in the argument description, the stored procedure will return an error.

Related content