Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
How to: Set a Trace Filter (Transact-SQL)
Collapse the table of content
Expand the table of content

How to: Set a Trace Filter (Transact-SQL)

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

To 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 noteImportant

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 will return an error.

Community Additions

ADD
Show:
© 2015 Microsoft