Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

SQL Profiler sp_trace_setfilter parameters Expand / Collapse
Author
Message
Posted Wednesday, May 15, 2013 7:36 AM


SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: 2 days ago @ 12:30 PM
Points: 75, Visits: 350
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
Post #1453094
Posted Wednesday, May 15, 2013 10:40 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: 2 days ago @ 12:10 PM
Points: 10,191, Visits: 13,115
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







Jack Corbett

Applications Developer

Don't let the good be the enemy of the best. -- Paul Fleming

Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
How to Post Performance Problems
Crosstabs and Pivots or How to turn rows into columns Part 1
Crosstabs and Pivots or How to turn rows into columns Part 2
Post #1453223
Posted Wednesday, May 15, 2013 11:17 AM


SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: 2 days ago @ 12:30 PM
Points: 75, Visits: 350
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'


Post #1453232
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse