Creating a trace from a script with filters.

  • I have a basic script to create a trace which works fine, but I would like to add filters. So I added the sp_trace_setfilter logic, which works fine for textdata column:

    exec sp_trace_setfilter @traceid, 10, 0, 7, N'Set RowCount 0'

    But not for LoginName column:

    exec sp_trace_setfilter @traceid, 11, 0, 7, N'LoginName'

    Has anyone else seen this/resolved this?

    There is an exception to every rule, except this one...

  • I think you need to set the trace event first:

    EXEC sp_trace_setevent @TraceID, 13, 11, 1

    EXEC sp_trace_setfilter @TraceID, 1, 11, 0, 0, N'joe';

    ______________________________________________________________________________Never argue with an idiot; Theyll drag you down to their level and beat you with experience

  • I should've mentioned that earlier, yes the sp_trace_setevent was a part of the script.

    example:

    exec sp_trace_setevent @TraceID, 12, 11, @on

    exec sp_trace_setevent @TraceID, 10, 11, @on

    There is an exception to every rule, except this one...

  • Try to pass 1 (not equal) instead of 7 (not like)

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

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