Problem With Sql Trace

  • I'm trying to filter out an object name, @tab, which comes through as an EventClass 46, column ID 34, Create Object.

    The code I use in the filter is :

    exec sp_trace_setfilter @TraceID, 34, 0, 7, N'@tab%'

    exec sp_trace_setfilter @TraceID, 34, 0, 7, N'@tab'

    but it still comes through.

    Any Ideas

  • From above, it is taking @tab as the object name. Don't put @tab in quotes.

  • Tried your suggestion with different permutaions and still no luck.  Seems like it accespts the @ as a reserved character unless I'm missing something.

    Is the captial N required?  What does that do?

    Code Follows:

    exec sp_trace_setfilter @TraceID, 34, 0, 7, N'#temp'

    exec sp_trace_setfilter @TraceID, 34, 0, 7, N'#temp%'

    exec sp_trace_setfilter @TraceID, 34, 0, 7, N'#%'

    exec sp_trace_setfilter @TraceID, 35, 0, 7, N'tempdb'

    ---exec sp_trace_setfilter @TraceID, 34, 0, 7, N@tab%

    exec sp_trace_setfilter @TraceID, 34, 0, 7, N'"@"tab'

     

    thks

  • You probably need to do something like

    exec sp_trace_setfilter @TraceID, 34, 0, 7, @tab

    I assume that the variable @tab contains the value that you wish to filter on.  If you want to use a wild card then this will need to be part of the string assigned to @tab

    e.g. Set @tab = 'objectname%'

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

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