SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


SQL Profiler sp_trace_setfilter parameters


SQL Profiler sp_trace_setfilter parameters

Author
Message
johnnyrmtl
johnnyrmtl
SSC Veteran
SSC Veteran (235 reputation)SSC Veteran (235 reputation)SSC Veteran (235 reputation)SSC Veteran (235 reputation)SSC Veteran (235 reputation)SSC Veteran (235 reputation)SSC Veteran (235 reputation)SSC Veteran (235 reputation)

Group: General Forum Members
Points: 235 Visits: 429
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
Jack Corbett
  Jack Corbett
SSCoach
SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)

Group: General Forum Members
Points: 18316 Visits: 14889
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
At best you can say that one job may be more secure than another, but total job security is an illusion. -- Rod at work

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
johnnyrmtl
johnnyrmtl
SSC Veteran
SSC Veteran (235 reputation)SSC Veteran (235 reputation)SSC Veteran (235 reputation)SSC Veteran (235 reputation)SSC Veteran (235 reputation)SSC Veteran (235 reputation)SSC Veteran (235 reputation)SSC Veteran (235 reputation)

Group: General Forum Members
Points: 235 Visits: 429
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'
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search