SQL Profiler Trace Filter Scripting

  • Hi,

    I created a Server Side Trace to audit my database. I create it in SQL Server Profiler and export it as a script for SQL Server 2005. After i run it in query analyzer, the trace file crated in the directory.

    My problem is, when i open the trace file i see that the column filters, which i defined before, don't work and trace saves all data, any action on the server.

    Do you have any ideas, why it doesn't work the filter?

    Thanks.

  • Hi

    Are you sure that filers are well-designed? May you send your scripts?

  • Hi thanks for the reply . Here's the script.

    /****************************************************/

    /* Created by: SQL Server Profiler 2005 */

    /* Date: 03/09/2008 11:31:34 */

    /****************************************************/

    -- Create a Queue

    declare @rc int

    declare @TraceID int

    declare @maxfilesize bigint

    set @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 share

    exec @rc = sp_trace_create @TraceID output, 0, N'E:\trace', @maxfilesize, NULL

    if (@rc != 0) goto error

    -- Client side File and Table cannot be scripted

    -- Set the events

    declare @on bit

    set @on = 1

    exec sp_trace_setevent @TraceID, 109, 7, @on

    exec sp_trace_setevent @TraceID, 109, 23, @on

    exec sp_trace_setevent @TraceID, 109, 39, @on

    exec sp_trace_setevent @TraceID, 109, 8, @on

    exec sp_trace_setevent @TraceID, 109, 40, @on

    exec sp_trace_setevent @TraceID, 109, 64, @on

    exec sp_trace_setevent @TraceID, 109, 9, @on

    exec sp_trace_setevent @TraceID, 109, 41, @on

    exec sp_trace_setevent @TraceID, 109, 49, @on

    exec sp_trace_setevent @TraceID, 109, 6, @on

    exec sp_trace_setevent @TraceID, 109, 10, @on

    exec sp_trace_setevent @TraceID, 109, 14, @on

    exec sp_trace_setevent @TraceID, 109, 26, @on

    exec sp_trace_setevent @TraceID, 109, 38, @on

    exec sp_trace_setevent @TraceID, 109, 42, @on

    exec sp_trace_setevent @TraceID, 109, 50, @on

    exec sp_trace_setevent @TraceID, 109, 3, @on

    exec sp_trace_setevent @TraceID, 109, 11, @on

    exec sp_trace_setevent @TraceID, 109, 35, @on

    exec sp_trace_setevent @TraceID, 109, 43, @on

    exec sp_trace_setevent @TraceID, 109, 51, @on

    exec sp_trace_setevent @TraceID, 109, 4, @on

    exec sp_trace_setevent @TraceID, 109, 12, @on

    exec sp_trace_setevent @TraceID, 109, 44, @on

    exec sp_trace_setevent @TraceID, 109, 60, @on

    exec sp_trace_setevent @TraceID, 109, 21, @on

    exec sp_trace_setevent @TraceID, 109, 37, @on

    exec sp_trace_setevent @TraceID, 108, 7, @on

    exec sp_trace_setevent @TraceID, 108, 23, @on

    exec sp_trace_setevent @TraceID, 108, 8, @on

    exec sp_trace_setevent @TraceID, 108, 40, @on

    exec sp_trace_setevent @TraceID, 108, 64, @on

    exec sp_trace_setevent @TraceID, 108, 1, @on

    exec sp_trace_setevent @TraceID, 108, 9, @on

    exec sp_trace_setevent @TraceID, 108, 41, @on

    exec sp_trace_setevent @TraceID, 108, 49, @on

    exec sp_trace_setevent @TraceID, 108, 10, @on

    exec sp_trace_setevent @TraceID, 108, 26, @on

    exec sp_trace_setevent @TraceID, 108, 34, @on

    exec sp_trace_setevent @TraceID, 108, 42, @on

    exec sp_trace_setevent @TraceID, 108, 50, @on

    exec sp_trace_setevent @TraceID, 108, 3, @on

    exec sp_trace_setevent @TraceID, 108, 11, @on

    exec sp_trace_setevent @TraceID, 108, 35, @on

    exec sp_trace_setevent @TraceID, 108, 43, @on

    exec sp_trace_setevent @TraceID, 108, 51, @on

    exec sp_trace_setevent @TraceID, 108, 4, @on

    exec sp_trace_setevent @TraceID, 108, 12, @on

    exec sp_trace_setevent @TraceID, 108, 28, @on

    exec sp_trace_setevent @TraceID, 108, 60, @on

    exec sp_trace_setevent @TraceID, 108, 21, @on

    exec sp_trace_setevent @TraceID, 108, 37, @on

    exec sp_trace_setevent @TraceID, 108, 6, @on

    exec sp_trace_setevent @TraceID, 108, 14, @on

    exec sp_trace_setevent @TraceID, 108, 38, @on

    exec sp_trace_setevent @TraceID, 110, 7, @on

    exec sp_trace_setevent @TraceID, 110, 23, @on

    exec sp_trace_setevent @TraceID, 110, 39, @on

    exec sp_trace_setevent @TraceID, 110, 8, @on

    exec sp_trace_setevent @TraceID, 110, 40, @on

    exec sp_trace_setevent @TraceID, 110, 64, @on

    exec sp_trace_setevent @TraceID, 110, 1, @on

    exec sp_trace_setevent @TraceID, 110, 9, @on

    exec sp_trace_setevent @TraceID, 110, 41, @on

    exec sp_trace_setevent @TraceID, 110, 49, @on

    exec sp_trace_setevent @TraceID, 110, 6, @on

    exec sp_trace_setevent @TraceID, 110, 10, @on

    exec sp_trace_setevent @TraceID, 110, 14, @on

    exec sp_trace_setevent @TraceID, 110, 26, @on

    exec sp_trace_setevent @TraceID, 110, 34, @on

    exec sp_trace_setevent @TraceID, 110, 38, @on

    exec sp_trace_setevent @TraceID, 110, 50, @on

    exec sp_trace_setevent @TraceID, 110, 3, @on

    exec sp_trace_setevent @TraceID, 110, 11, @on

    exec sp_trace_setevent @TraceID, 110, 35, @on

    exec sp_trace_setevent @TraceID, 110, 51, @on

    exec sp_trace_setevent @TraceID, 110, 4, @on

    exec sp_trace_setevent @TraceID, 110, 12, @on

    exec sp_trace_setevent @TraceID, 110, 28, @on

    exec sp_trace_setevent @TraceID, 110, 60, @on

    exec sp_trace_setevent @TraceID, 110, 21, @on

    exec sp_trace_setevent @TraceID, 110, 37, @on

    exec sp_trace_setevent @TraceID, 111, 7, @on

    exec sp_trace_setevent @TraceID, 111, 23, @on

    exec sp_trace_setevent @TraceID, 111, 8, @on

    exec sp_trace_setevent @TraceID, 111, 40, @on

    exec sp_trace_setevent @TraceID, 111, 64, @on

    exec sp_trace_setevent @TraceID, 111, 9, @on

    exec sp_trace_setevent @TraceID, 111, 21, @on

    exec sp_trace_setevent @TraceID, 111, 41, @on

    exec sp_trace_setevent @TraceID, 111, 49, @on

    exec sp_trace_setevent @TraceID, 111, 6, @on

    exec sp_trace_setevent @TraceID, 111, 10, @on

    exec sp_trace_setevent @TraceID, 111, 14, @on

    exec sp_trace_setevent @TraceID, 111, 26, @on

    exec sp_trace_setevent @TraceID, 111, 38, @on

    exec sp_trace_setevent @TraceID, 111, 50, @on

    exec sp_trace_setevent @TraceID, 111, 3, @on

    exec sp_trace_setevent @TraceID, 111, 11, @on

    exec sp_trace_setevent @TraceID, 111, 35, @on

    exec sp_trace_setevent @TraceID, 111, 51, @on

    exec sp_trace_setevent @TraceID, 111, 4, @on

    exec sp_trace_setevent @TraceID, 111, 12, @on

    exec sp_trace_setevent @TraceID, 111, 60, @on

    exec sp_trace_setevent @TraceID, 104, 7, @on

    exec sp_trace_setevent @TraceID, 104, 23, @on

    exec sp_trace_setevent @TraceID, 104, 8, @on

    exec sp_trace_setevent @TraceID, 104, 64, @on

    exec sp_trace_setevent @TraceID, 104, 9, @on

    exec sp_trace_setevent @TraceID, 104, 21, @on

    exec sp_trace_setevent @TraceID, 104, 41, @on

    exec sp_trace_setevent @TraceID, 104, 49, @on

    exec sp_trace_setevent @TraceID, 104, 6, @on

    exec sp_trace_setevent @TraceID, 104, 10, @on

    exec sp_trace_setevent @TraceID, 104, 14, @on

    exec sp_trace_setevent @TraceID, 104, 26, @on

    exec sp_trace_setevent @TraceID, 104, 42, @on

    exec sp_trace_setevent @TraceID, 104, 50, @on

    exec sp_trace_setevent @TraceID, 104, 3, @on

    exec sp_trace_setevent @TraceID, 104, 11, @on

    exec sp_trace_setevent @TraceID, 104, 35, @on

    exec sp_trace_setevent @TraceID, 104, 43, @on

    exec sp_trace_setevent @TraceID, 104, 51, @on

    exec sp_trace_setevent @TraceID, 104, 4, @on

    exec sp_trace_setevent @TraceID, 104, 12, @on

    exec sp_trace_setevent @TraceID, 104, 60, @on

    exec sp_trace_setevent @TraceID, 112, 7, @on

    exec sp_trace_setevent @TraceID, 112, 23, @on

    exec sp_trace_setevent @TraceID, 112, 8, @on

    exec sp_trace_setevent @TraceID, 112, 40, @on

    exec sp_trace_setevent @TraceID, 112, 64, @on

    exec sp_trace_setevent @TraceID, 112, 1, @on

    exec sp_trace_setevent @TraceID, 112, 9, @on

    exec sp_trace_setevent @TraceID, 112, 41, @on

    exec sp_trace_setevent @TraceID, 112, 49, @on

    exec sp_trace_setevent @TraceID, 112, 6, @on

    exec sp_trace_setevent @TraceID, 112, 10, @on

    exec sp_trace_setevent @TraceID, 112, 14, @on

    exec sp_trace_setevent @TraceID, 112, 26, @on

    exec sp_trace_setevent @TraceID, 112, 34, @on

    exec sp_trace_setevent @TraceID, 112, 38, @on

    exec sp_trace_setevent @TraceID, 112, 50, @on

    exec sp_trace_setevent @TraceID, 112, 3, @on

    exec sp_trace_setevent @TraceID, 112, 11, @on

    exec sp_trace_setevent @TraceID, 112, 35, @on

    exec sp_trace_setevent @TraceID, 112, 51, @on

    exec sp_trace_setevent @TraceID, 112, 4, @on

    exec sp_trace_setevent @TraceID, 112, 12, @on

    exec sp_trace_setevent @TraceID, 112, 28, @on

    exec sp_trace_setevent @TraceID, 112, 60, @on

    exec sp_trace_setevent @TraceID, 112, 37, @on

    exec sp_trace_setevent @TraceID, 115, 7, @on

    exec sp_trace_setevent @TraceID, 115, 23, @on

    exec sp_trace_setevent @TraceID, 115, 8, @on

    exec sp_trace_setevent @TraceID, 115, 40, @on

    exec sp_trace_setevent @TraceID, 115, 64, @on

    exec sp_trace_setevent @TraceID, 115, 1, @on

    exec sp_trace_setevent @TraceID, 115, 9, @on

    exec sp_trace_setevent @TraceID, 115, 21, @on

    exec sp_trace_setevent @TraceID, 115, 41, @on

    exec sp_trace_setevent @TraceID, 115, 49, @on

    exec sp_trace_setevent @TraceID, 115, 6, @on

    exec sp_trace_setevent @TraceID, 115, 10, @on

    exec sp_trace_setevent @TraceID, 115, 14, @on

    exec sp_trace_setevent @TraceID, 115, 26, @on

    exec sp_trace_setevent @TraceID, 115, 50, @on

    exec sp_trace_setevent @TraceID, 115, 3, @on

    exec sp_trace_setevent @TraceID, 115, 11, @on

    exec sp_trace_setevent @TraceID, 115, 35, @on

    exec sp_trace_setevent @TraceID, 115, 51, @on

    exec sp_trace_setevent @TraceID, 115, 4, @on

    exec sp_trace_setevent @TraceID, 115, 12, @on

    exec sp_trace_setevent @TraceID, 115, 60, @on

    exec sp_trace_setevent @TraceID, 152, 7, @on

    exec sp_trace_setevent @TraceID, 152, 23, @on

    exec sp_trace_setevent @TraceID, 152, 39, @on

    exec sp_trace_setevent @TraceID, 152, 8, @on

    exec sp_trace_setevent @TraceID, 152, 40, @on

    exec sp_trace_setevent @TraceID, 152, 64, @on

    exec sp_trace_setevent @TraceID, 152, 1, @on

    exec sp_trace_setevent @TraceID, 152, 9, @on

    exec sp_trace_setevent @TraceID, 152, 41, @on

    exec sp_trace_setevent @TraceID, 152, 49, @on

    exec sp_trace_setevent @TraceID, 152, 6, @on

    exec sp_trace_setevent @TraceID, 152, 10, @on

    exec sp_trace_setevent @TraceID, 152, 14, @on

    exec sp_trace_setevent @TraceID, 152, 26, @on

    exec sp_trace_setevent @TraceID, 152, 42, @on

    exec sp_trace_setevent @TraceID, 152, 50, @on

    exec sp_trace_setevent @TraceID, 152, 3, @on

    exec sp_trace_setevent @TraceID, 152, 11, @on

    exec sp_trace_setevent @TraceID, 152, 35, @on

    exec sp_trace_setevent @TraceID, 152, 43, @on

    exec sp_trace_setevent @TraceID, 152, 51, @on

    exec sp_trace_setevent @TraceID, 152, 4, @on

    exec sp_trace_setevent @TraceID, 152, 12, @on

    exec sp_trace_setevent @TraceID, 152, 60, @on

    exec sp_trace_setevent @TraceID, 116, 7, @on

    exec sp_trace_setevent @TraceID, 116, 23, @on

    exec sp_trace_setevent @TraceID, 116, 8, @on

    exec sp_trace_setevent @TraceID, 116, 40, @on

    exec sp_trace_setevent @TraceID, 116, 64, @on

    exec sp_trace_setevent @TraceID, 116, 1, @on

    exec sp_trace_setevent @TraceID, 116, 9, @on

    exec sp_trace_setevent @TraceID, 116, 41, @on

    exec sp_trace_setevent @TraceID, 116, 49, @on

    exec sp_trace_setevent @TraceID, 116, 6, @on

    exec sp_trace_setevent @TraceID, 116, 10, @on

    exec sp_trace_setevent @TraceID, 116, 14, @on

    exec sp_trace_setevent @TraceID, 116, 26, @on

    exec sp_trace_setevent @TraceID, 116, 50, @on

    exec sp_trace_setevent @TraceID, 116, 3, @on

    exec sp_trace_setevent @TraceID, 116, 11, @on

    exec sp_trace_setevent @TraceID, 116, 35, @on

    exec sp_trace_setevent @TraceID, 116, 51, @on

    exec sp_trace_setevent @TraceID, 116, 4, @on

    exec sp_trace_setevent @TraceID, 116, 12, @on

    exec sp_trace_setevent @TraceID, 116, 44, @on

    exec sp_trace_setevent @TraceID, 116, 60, @on

    exec sp_trace_setevent @TraceID, 116, 5, @on

    exec sp_trace_setevent @TraceID, 116, 29, @on

    exec sp_trace_setevent @TraceID, 116, 37, @on

    exec sp_trace_setevent @TraceID, 128, 7, @on

    exec sp_trace_setevent @TraceID, 128, 23, @on

    exec sp_trace_setevent @TraceID, 128, 8, @on

    exec sp_trace_setevent @TraceID, 128, 40, @on

    exec sp_trace_setevent @TraceID, 128, 64, @on

    exec sp_trace_setevent @TraceID, 128, 1, @on

    exec sp_trace_setevent @TraceID, 128, 21, @on

    exec sp_trace_setevent @TraceID, 128, 37, @on

    exec sp_trace_setevent @TraceID, 128, 41, @on

    exec sp_trace_setevent @TraceID, 128, 49, @on

    exec sp_trace_setevent @TraceID, 128, 6, @on

    exec sp_trace_setevent @TraceID, 128, 10, @on

    exec sp_trace_setevent @TraceID, 128, 14, @on

    exec sp_trace_setevent @TraceID, 128, 26, @on

    exec sp_trace_setevent @TraceID, 128, 34, @on

    exec sp_trace_setevent @TraceID, 128, 50, @on

    exec sp_trace_setevent @TraceID, 128, 3, @on

    exec sp_trace_setevent @TraceID, 128, 11, @on

    exec sp_trace_setevent @TraceID, 128, 35, @on

    exec sp_trace_setevent @TraceID, 128, 51, @on

    exec sp_trace_setevent @TraceID, 128, 4, @on

    exec sp_trace_setevent @TraceID, 128, 12, @on

    exec sp_trace_setevent @TraceID, 128, 28, @on

    exec sp_trace_setevent @TraceID, 128, 60, @on

    exec sp_trace_setevent @TraceID, 180, 7, @on

    exec sp_trace_setevent @TraceID, 180, 23, @on

    exec sp_trace_setevent @TraceID, 180, 8, @on

    exec sp_trace_setevent @TraceID, 180, 40, @on

    exec sp_trace_setevent @TraceID, 180, 64, @on

    exec sp_trace_setevent @TraceID, 180, 1, @on

    exec sp_trace_setevent @TraceID, 180, 37, @on

    exec sp_trace_setevent @TraceID, 180, 41, @on

    exec sp_trace_setevent @TraceID, 180, 49, @on

    exec sp_trace_setevent @TraceID, 180, 6, @on

    exec sp_trace_setevent @TraceID, 180, 10, @on

    exec sp_trace_setevent @TraceID, 180, 14, @on

    exec sp_trace_setevent @TraceID, 180, 26, @on

    exec sp_trace_setevent @TraceID, 180, 34, @on

    exec sp_trace_setevent @TraceID, 180, 50, @on

    exec sp_trace_setevent @TraceID, 180, 3, @on

    exec sp_trace_setevent @TraceID, 180, 11, @on

    exec sp_trace_setevent @TraceID, 180, 19, @on

    exec sp_trace_setevent @TraceID, 180, 35, @on

    exec sp_trace_setevent @TraceID, 180, 51, @on

    exec sp_trace_setevent @TraceID, 180, 4, @on

    exec sp_trace_setevent @TraceID, 180, 12, @on

    exec sp_trace_setevent @TraceID, 180, 28, @on

    exec sp_trace_setevent @TraceID, 180, 60, @on

    exec sp_trace_setevent @TraceID, 129, 7, @on

    exec sp_trace_setevent @TraceID, 129, 23, @on

    exec sp_trace_setevent @TraceID, 129, 8, @on

    exec sp_trace_setevent @TraceID, 129, 40, @on

    exec sp_trace_setevent @TraceID, 129, 64, @on

    exec sp_trace_setevent @TraceID, 129, 1, @on

    exec sp_trace_setevent @TraceID, 129, 21, @on

    exec sp_trace_setevent @TraceID, 129, 37, @on

    exec sp_trace_setevent @TraceID, 129, 41, @on

    exec sp_trace_setevent @TraceID, 129, 49, @on

    exec sp_trace_setevent @TraceID, 129, 6, @on

    exec sp_trace_setevent @TraceID, 129, 10, @on

    exec sp_trace_setevent @TraceID, 129, 14, @on

    exec sp_trace_setevent @TraceID, 129, 26, @on

    exec sp_trace_setevent @TraceID, 129, 34, @on

    exec sp_trace_setevent @TraceID, 129, 50, @on

    exec sp_trace_setevent @TraceID, 129, 3, @on

    exec sp_trace_setevent @TraceID, 129, 11, @on

    exec sp_trace_setevent @TraceID, 129, 35, @on

    exec sp_trace_setevent @TraceID, 129, 51, @on

    exec sp_trace_setevent @TraceID, 129, 4, @on

    exec sp_trace_setevent @TraceID, 129, 12, @on

    exec sp_trace_setevent @TraceID, 129, 28, @on

    exec sp_trace_setevent @TraceID, 129, 60, @on

    exec sp_trace_setevent @TraceID, 135, 7, @on

    exec sp_trace_setevent @TraceID, 135, 23, @on

    exec sp_trace_setevent @TraceID, 135, 39, @on

    exec sp_trace_setevent @TraceID, 135, 8, @on

    exec sp_trace_setevent @TraceID, 135, 40, @on

    exec sp_trace_setevent @TraceID, 135, 64, @on

    exec sp_trace_setevent @TraceID, 135, 1, @on

    exec sp_trace_setevent @TraceID, 135, 37, @on

    exec sp_trace_setevent @TraceID, 135, 41, @on

    exec sp_trace_setevent @TraceID, 135, 49, @on

    exec sp_trace_setevent @TraceID, 135, 6, @on

    exec sp_trace_setevent @TraceID, 135, 10, @on

    exec sp_trace_setevent @TraceID, 135, 14, @on

    exec sp_trace_setevent @TraceID, 135, 26, @on

    exec sp_trace_setevent @TraceID, 135, 34, @on

    exec sp_trace_setevent @TraceID, 135, 50, @on

    exec sp_trace_setevent @TraceID, 135, 3, @on

    exec sp_trace_setevent @TraceID, 135, 11, @on

    exec sp_trace_setevent @TraceID, 135, 35, @on

    exec sp_trace_setevent @TraceID, 135, 51, @on

    exec sp_trace_setevent @TraceID, 135, 4, @on

    exec sp_trace_setevent @TraceID, 135, 12, @on

    exec sp_trace_setevent @TraceID, 135, 28, @on

    exec sp_trace_setevent @TraceID, 135, 60, @on

    exec sp_trace_setevent @TraceID, 114, 7, @on

    exec sp_trace_setevent @TraceID, 114, 23, @on

    exec sp_trace_setevent @TraceID, 114, 8, @on

    exec sp_trace_setevent @TraceID, 114, 40, @on

    exec sp_trace_setevent @TraceID, 114, 64, @on

    exec sp_trace_setevent @TraceID, 114, 1, @on

    exec sp_trace_setevent @TraceID, 114, 9, @on

    exec sp_trace_setevent @TraceID, 114, 41, @on

    exec sp_trace_setevent @TraceID, 114, 49, @on

    exec sp_trace_setevent @TraceID, 114, 6, @on

    exec sp_trace_setevent @TraceID, 114, 10, @on

    exec sp_trace_setevent @TraceID, 114, 14, @on

    exec sp_trace_setevent @TraceID, 114, 26, @on

    exec sp_trace_setevent @TraceID, 114, 34, @on

    exec sp_trace_setevent @TraceID, 114, 50, @on

    exec sp_trace_setevent @TraceID, 114, 3, @on

    exec sp_trace_setevent @TraceID, 114, 11, @on

    exec sp_trace_setevent @TraceID, 114, 19, @on

    exec sp_trace_setevent @TraceID, 114, 35, @on

    exec sp_trace_setevent @TraceID, 114, 51, @on

    exec sp_trace_setevent @TraceID, 114, 59, @on

    exec sp_trace_setevent @TraceID, 114, 4, @on

    exec sp_trace_setevent @TraceID, 114, 12, @on

    exec sp_trace_setevent @TraceID, 114, 28, @on

    exec sp_trace_setevent @TraceID, 114, 44, @on

    exec sp_trace_setevent @TraceID, 114, 60, @on

    exec sp_trace_setevent @TraceID, 114, 37, @on

    exec sp_trace_setevent @TraceID, 131, 7, @on

    exec sp_trace_setevent @TraceID, 131, 23, @on

    exec sp_trace_setevent @TraceID, 131, 8, @on

    exec sp_trace_setevent @TraceID, 131, 40, @on

    exec sp_trace_setevent @TraceID, 131, 64, @on

    exec sp_trace_setevent @TraceID, 131, 1, @on

    exec sp_trace_setevent @TraceID, 131, 41, @on

    exec sp_trace_setevent @TraceID, 131, 49, @on

    exec sp_trace_setevent @TraceID, 131, 6, @on

    exec sp_trace_setevent @TraceID, 131, 10, @on

    exec sp_trace_setevent @TraceID, 131, 14, @on

    exec sp_trace_setevent @TraceID, 131, 26, @on

    exec sp_trace_setevent @TraceID, 131, 34, @on

    exec sp_trace_setevent @TraceID, 131, 50, @on

    exec sp_trace_setevent @TraceID, 131, 3, @on

    exec sp_trace_setevent @TraceID, 131, 11, @on

    exec sp_trace_setevent @TraceID, 131, 35, @on

    exec sp_trace_setevent @TraceID, 131, 51, @on

    exec sp_trace_setevent @TraceID, 131, 59, @on

    exec sp_trace_setevent @TraceID, 131, 4, @on

    exec sp_trace_setevent @TraceID, 131, 12, @on

    exec sp_trace_setevent @TraceID, 131, 28, @on

    exec sp_trace_setevent @TraceID, 131, 60, @on

    exec sp_trace_setevent @TraceID, 131, 21, @on

    exec sp_trace_setevent @TraceID, 131, 37, @on

    exec sp_trace_setevent @TraceID, 17, 12, @on

    exec sp_trace_setevent @TraceID, 17, 1, @on

    exec sp_trace_setevent @TraceID, 17, 9, @on

    exec sp_trace_setevent @TraceID, 17, 2, @on

    exec sp_trace_setevent @TraceID, 17, 6, @on

    exec sp_trace_setevent @TraceID, 17, 10, @on

    exec sp_trace_setevent @TraceID, 17, 14, @on

    exec sp_trace_setevent @TraceID, 17, 11, @on

    -- Set the Filters

    declare @intfilter int

    declare @bigintfilter bigint

    exec sp_trace_setfilter @TraceID, 1, 0, 1, N''

    exec sp_trace_setfilter @TraceID, 10, 0, 7, N'SQL Server Profiler - 5b2b276f-6996-4f88-bedb-d5b9f46858a0'

    set @bigintfilter = 0

    exec sp_trace_setfilter @TraceID, 19, 0, 1, @bigintfilter

    exec sp_trace_setfilter @TraceID, 35, 1, 6, N'123123'

    -- Set the trace status to start

    exec sp_trace_setstatus @TraceID, 1

    -- display trace id for future references

    select TraceID=@TraceID

    goto finish

    error:

    select ErrorCode=@rc

    finish:

    go

  • Hi,

    I found the error, maybe there will be other people who want to learn it. Actually it is an error of SQL Server 2005. When you script your trace it generates the code but the "set filter" part is not generated correctly. So, in my code "exec sp_trace_setfilter @TraceID, 35, 1, 6, N'123123'" i want to get only '123123'(name of my database)'s informations. So here you have to change 1 to 0 (1 or, 0 and).

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply