Re: Problem using SP_TRACE_SETFILTER - it doesn't seem to apply th

From: Wanderer (Wanderer_at_discussions.microsoft.com)
Date: 01/03/05


Date: Mon, 3 Jan 2005 01:45:02 -0800

Well, I've tried to add steps to check on the adding of the filters, and all
i can say is - it doesn't seem to work!

Here is a section of the code (hopefully the wordwrap doesn't make it
completely illegible).
****code****
exec sp_trace_setfilter
@TraceId,@ColumnId,@LogicalOperator,@ComparisonOperator,@DurationFilterValue
select @ReturnCode=@@Error
Print 'Trace Filter 2 set'
if @ReturnCode <> 0
        Begin
        if @ReturnCode = 1
                print 'ERROR 1 - Unknown error.'
        else
        if @ReturnCode = 2
                Print 'ERROR 2 - The trace is currently running. Changing the trace at
this time will result in an error.'
        else
        if @ReturnCode = 4
                Print 'ERROR 4 - The specified Column is not valid.'
        else
        if @ReturnCode = 5
                print 'ERROR 5 - The specified Column is not allowed for filtering.'
        else
        if @ReturnCode = 6
                print 'ERROR 6 - The specified Comparison Operator is not valid. '
        else
        if @ReturnCode = 7
                print 'ERROR 7 - The specified Logical Operator is not valid.'
        else
        if @ReturnCode = 9
                print 'ERROR 9 - The specified Trace Handle is not valid.'
        else
        if @ReturnCode = 13
                print 'ERROR 13 - Out of memory. Returned when there is not enough memory
to perform the specified action.'
        else
        if @ReturnCode = 16
                print 'ERROR 16 - The function is not valid for this trace.'
        else
                Print 'ERROR x - Unknown Error'
        GoTo ErrorHandler
end
SELECT * FROM ::fn_trace_getfilterinfo(@TraceID)
****code****

I get NO response that an error has occurred, the "print's" confirm that the
code stepped through, yet the ::fn_trace_setfilter returns NO ROWS!

"David Gugick" wrote:

> Wanderer wrote:
> > Ok - so it seems that, for some reason, the sp_trace_setfilter is not
> > working. Going to try and build in some logic to catch and check why.
> > Anything that you can see from my SP, that points the way, I'd
> > appreciate hearing it.
> >
>
> You wouldn't see the filter in Profiler if you opened a TRC file after a
> server-side trace. All you see in Profiler is the events captured during
> the trace. The other information (filters) are not saved anywhere in the
> trace file.
>
> Also, I assume when you ran the following statement, you knew that the
> running trace had a handle of 1? It seems unlikely that the handle would
> be 1 unless you just cycled the server.
> SELECT * FROM ::fn_trace_getfilterinfo(1)
>
> I can't read your script file because of the wrapping. What events did
> you capture that are not showing the filter applied?
>
> --
> David Gugick
> Imceda Software
> www.imceda.com
>
>



Relevant Pages

  • Re: Logging
    ... > Can you explain a little more what you mean about TextData Column ... You'll need to read up on Profiler in BOL. ... columns of data you can capture from a trace. ... Add a filter for the users on the LoginName (make sure the filter works ...
    (microsoft.public.sqlserver.server)
  • Re: [PATCH 0/3] ftrace: updates for tip
    ... I added a "trace" flags field in the task structure. ... The second patch uses this for the ftrace pid code. ... Regarding the filter functions, ... to only specify the PID, ...
    (Linux-Kernel)
  • Re: Problem using SP_TRACE_SETFILTER - it doesnt seem to apply th
    ... I was intimating that you open profiler and set the filter ... I don't dispute that your trace runs fine. ...
    (microsoft.public.sqlserver.server)
  • Re: Problem using SP_TRACE_SETFILTER - it doesnt seem to apply th
    ... server-side trace. ... All you see in Profiler is the events captured during ... you capture that are not showing the filter applied? ...
    (microsoft.public.sqlserver.server)
  • Re: Continuous Network Diagram for a Single Task
    ... Go to my website and download the "Trace" macro. ... Now switch to the network diagram. ... >From the project menu select filtered for, ...
    (microsoft.public.project)

Loading