SQL Profiler sp_trace_setfilter parameters

  • Hello,

    I am trying to exclude some users from being captured from a trace.

    If the traceid I have is 2

    I see that the syntax mentions this below so would these be the parameters for each user?

    exec sp_trace_setfilter 2, 10, 0, 7, N'userhere'

    -- EXEC sp_trace_setfilter

    -- @trace_id = 2,

    -- @columnid = 10, --app name column

    -- @logicaloperator = 1, -- logical "or"

    -- @comparisonoperator = 0, -- equals

    -- @value = N'SQL Profiler'

    Thanks

  • You need to change the column id parameter to the one you need.

    SELECT

    *

    FROM

    sys.trace_columns AS TC

    WHERE

    name LIKE '%name'

    My guess is that you want NTUserName which is column id 6.

    I'd recommend using the profiler GUI to define your trace. Start and stop it, then go to File -> Export -> Script Trace Definition

  • If i want to exclude SYSLOGINS , not necessarily NTusernames as defined within the instance it looks like its this

    exec sp_trace_setfilter @TraceID, 11, 0, 7, N'xxxxxxx'

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply