Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 Question on Creating Trace Filters

Author  Topic 

MartinSmith
Starting Member

17 Posts

Posted - 2010-01-09 : 19:10:33
The sp_trace_setfilter procedure has a @logical_operator parameter that Specifies whether the AND (0) or OR (1) operator is applied. I can't see anywhere where it is documented what it will do if I set up multiple filters with different values for this parameter

e.g. Will the following

sp_trace_setfilter 1, 10, 0, 6, N'SQLT%'
sp_trace_setfilter 1, 10, 1, 6, N'MS%'
sp_trace_setfilter 1, 11, 0, 0, N'joe'

Yield

((AppName LIKE 'SQLT%') OR (AppName LIKE 'MS%')) AND (UserName = 'joe')

-OR-

(AppName LIKE 'SQLT%') OR ((AppName LIKE 'MS%') AND (UserName = 'joe'))

jmejorado
Starting Member

1 Post

Posted - 2010-10-20 : 12:56:43
Hi did you get any update on this? I need to accomplish a request close to what you are describing, ie.
I need to discard all login/logout events from an specific user but record the rest, not sure if this can be done.
(eventclass='Login' or eventclass='Logout' and Username='joe')

Daniel
Go to Top of Page

MartinSmith
Starting Member

17 Posts

Posted - 2010-10-23 : 06:03:14
Hi Daniel,

I think in the end I just ended up setting up two different traces.

Are you on SQL Server 2008? If so using extended events is much more straight forward for setting up these filters.

If not I know that I have read in the interim how these boolean operators work I can't remember the details off the top of my head but if you need to know reply to this and I'll try and find the relevant book and chapter and summarise it for you.

Martin
Go to Top of Page
   

- Advertisement -