Server side Traces

Last Post 02 May 2002 12:04 PM by Corwin. 0 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
New Member
New Member

02 May 2002 12:04 PM
I have been attempting to set up server-side trace on a SQL Server 2000 box by utilizing the example on BOL (sp_trace_create) it will not work for me. It says it completes successfully but the trace is never started. The following code is what I am trying to use:
DECLARE @RC int, @TraceID int, @ON bit
SET @ON = 1
EXEC @RC = sp_trace_create @TraceID OUTPUT, 0, N' c:\TraceForSelect'
SELECT ' RC' = @RC, 'TraceID'=@TraceID

-- Statement completed events, start time column
EXEC @RC = sp_trace_setevent @TraceID, 41, 14, @ON
-- Statement completed events, database ID column
EXEC @RC = sp_trace_setevent @TraceID, 41, 3, @ON
-- Statement completed events, text column
EXEC @RC = sp_trace_setevent @TraceID, 41, 1, @ON
-- Statement completed events, duration column
EXEC @RC = sp_trace_setevent @TraceID, 41, 13, @ON
-- Login events, start column
EXEC @RC = sp_trace_setevent @TraceID, 14, 14, @ON

--Set filter for column1 (text), data contains SELECT
EXEC @RC = sp_trace_setfilter @TraceID, 1, 1, 6, N'%select%'

-- Start trace (status 1 = start)
EXEC @RC = sp_trace_setstatus @TraceID, 1

Any ideas on why it is not working?


DBA Group
State of South Dakota
Pierre, SD
You are not authorized to post a reply.

Acceptable Use Policy