/****************************************************//* Created by: SQL PRofiler *//* Date: 2004/06/19 16:50:05 *//****************************************************/-- Create a Queuedeclare @rc intdeclare @TraceID intdeclare @maxfilesize bigintset @maxfilesize = 5 -- Please replace the text InsertFileNameHere, with an appropriate-- filename prefixed by a path, e.g., c:/MyFolder/MyTrace. The .trc extension-- will be appended to the filename automatically. If you are writing from-- remote server to local drive, please use UNC path and make sure server has-- write access to your network shareexec @rc = sp_trace_create @TraceID output, 0, N'c:/test', @maxfilesize, NULL if (@rc != 0) goto error-- Client side File and Table cannot be scripted-- Writing to a table is not supported through the SP's-- Set the eventsdeclare @on bitset @on = 1exec sp_trace_setevent @TraceID, 12, 1, @onexec sp_trace_setevent @TraceID, 12, 12, @onexec sp_trace_setevent @TraceID, 12, 14, @on-- Set the Filtersdeclare @intfilter intdeclare @bigintfilter bigintexec sp_trace_setfilter @TraceID, 10, 0, 7, N'SQL Profiler'set @intfilter = 100exec sp_trace_setfilter @TraceID, 22, 0, 4, @intfilterset @intfilter = 1exec sp_trace_setfilter @TraceID, 23, 1, 0, @intfilterexec sp_trace_setfilter @TraceID, 35, 1, 6, N'pubs'-- Set the trace status to startexec sp_trace_setstatus @TraceID, 1-- display trace id for future referencesselect TraceID=@TraceIDgoto finisherror: select ErrorCode=@rcfinish: go |