how to solve the error 19055

  • the error is pasted here when run the SP

    sg 19055, Level 16, State 1, Procedure sp_trace_setfilter, Line 1

    Filters with the same event column ID must be grouped together.

    Please find code part of my Stored_procedure which is giving error.

    declare @intfilter int

    declare @bigintfilter bigint

    set @intfilter = 13

    exec sp_trace_setfilter @TraceID, 3, 1, 0, @intfilter

    exec sp_trace_setfilter @TraceID, 10, 1, 6, N'%SQL Server Management Studio%'

    exec sp_trace_setfilter @TraceID, 10, 0, 7, N'%.Net SqlClient Data Provider%'

    exec sp_trace_setfilter @TraceID, 35, 1, 6, N'%MyworksDatabase%'

    exec sp_trace_setfilter @TraceID, 35, 0, 7, N'%TempDB%'

    exec sp_trace_setfilter @TraceID, 35, 0, 7, N'%Master%'

    Now how do i group these events?

  • Did you set up the trace in Profiler and then export the definition or are you trying to create the trace by hand?

  • Yes, I created the trace with SQL Profiler and then exported the trace definition .

    now i wanted to sehedule the trace by SQL server Agent Job.

    I am able to run the same trace in SQL server Profiler with all the filters applied. it is giving errors when i try to run with Stored Procedures.

  • Was this ever solved? I have the same problem. My goal was to schedule a trace to run at a certain time. I created the trace and exported it. I can run the stored procedure and get the error, but the trace works. When I put it in sql agent job though it doesn't work. The only thing in the trace file is "trace started and trace stopped".

    Thanks very much for any ideas. My stored procedure for the trace is:

    set nocount on

    -- To change the traces duration, modify the following statement

    declare @StopTime datetime ; set @StopTime = dateadd(mi,30,getdate())

    declare @StartDatetime varchar(13) ; set @StartDatetime =

    convert(char(8),getdate(),112) + '_' + cast(replace(convert(varchar(5),getdate(),108),':','') as char(4)) --['YYYYMMDD_HHMM']

    declare @rc int

    declare @TraceID int

    declare @TraceFile nvarchar(100)

    declare @MaxFileSize bigint ; set @MaxFileSize = 100 -- The maximum trace file in megabytes

    declare @cmd nvarchar(2000)

    declare @msg nvarchar(200)

    If right(@Folder,1)<>'\' set @Folder = @Folder + '\'

    -- Check if Folder exists

    set @cmd = 'dir ' +@Folder

    exec @rc = master..xp_cmdshell @cmd,no_output

    if (@rc != 0) begin set @msg = 'The specified folder ' + @Folder + '

    does not exist, Please specify an existing drive:\folder '+ cast(@rc as

    varchar(10)) raiserror(@msg,10,1) return(-1)

    end

    --Create new trace file folder

    set @cmd = 'mkdir ' +@Folder+@StartDatetime

    exec @rc = master..xp_cmdshell @cmd,no_output

    if (@rc != 0) begin set @msg = 'Error creating trace folder : ' +

    cast(@rc as varchar(10)) set @msg = @msg + 'SQL Server 2005 or later

    instance require OLE Automation to been enabled' raiserror(@msg,10,1)

    return(-1)

    end

    set @TraceFile = @Folder+@StartDatetime+'\trace'

    exec @rc = sp_trace_create @TraceID output, 2, @TraceFile,

    @MaxFileSize, @StopTime

    if (@rc != 0) begin set @msg = 'Error creating trace : ' + cast(@rc as

    varchar(10)) raiserror(@msg,10,1) return(-1)

    end

    --> Using your saved trace file, add the '-- Set the events' section below <--

    declare @on bit

    set @on = 1

    exec sp_trace_setevent @TraceID, 14, 1, @on

    exec sp_trace_setevent @TraceID, 14, 9, @on

    exec sp_trace_setevent @TraceID, 14, 6, @on

    exec sp_trace_setevent @TraceID, 14, 10, @on

    exec sp_trace_setevent @TraceID, 14, 14, @on

    exec sp_trace_setevent @TraceID, 14, 11, @on

    exec sp_trace_setevent @TraceID, 14, 12, @on

    exec sp_trace_setevent @TraceID, 15, 15, @on

    exec sp_trace_setevent @TraceID, 15, 16, @on

    exec sp_trace_setevent @TraceID, 15, 9, @on

    exec sp_trace_setevent @TraceID, 15, 17, @on

    exec sp_trace_setevent @TraceID, 15, 6, @on

    exec sp_trace_setevent @TraceID, 15, 10, @on

    exec sp_trace_setevent @TraceID, 15, 14, @on

    exec sp_trace_setevent @TraceID, 15, 18, @on

    exec sp_trace_setevent @TraceID, 15, 11, @on

    exec sp_trace_setevent @TraceID, 15, 12, @on

    exec sp_trace_setevent @TraceID, 15, 13, @on

    exec sp_trace_setevent @TraceID, 17, 1, @on

    exec sp_trace_setevent @TraceID, 17, 9, @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

    exec sp_trace_setevent @TraceID, 17, 12, @on

    exec sp_trace_setevent @TraceID, 10, 15, @on

    exec sp_trace_setevent @TraceID, 10, 16, @on

    exec sp_trace_setevent @TraceID, 10, 9, @on

    exec sp_trace_setevent @TraceID, 10, 17, @on

    exec sp_trace_setevent @TraceID, 10, 2, @on

    exec sp_trace_setevent @TraceID, 10, 10, @on

    exec sp_trace_setevent @TraceID, 10, 18, @on

    exec sp_trace_setevent @TraceID, 10, 11, @on

    exec sp_trace_setevent @TraceID, 10, 12, @on

    exec sp_trace_setevent @TraceID, 10, 13, @on

    exec sp_trace_setevent @TraceID, 10, 6, @on

    exec sp_trace_setevent @TraceID, 10, 14, @on

    exec sp_trace_setevent @TraceID, 12, 15, @on

    exec sp_trace_setevent @TraceID, 12, 16, @on

    exec sp_trace_setevent @TraceID, 12, 1, @on

    exec sp_trace_setevent @TraceID, 12, 9, @on

    exec sp_trace_setevent @TraceID, 12, 17, @on

    exec sp_trace_setevent @TraceID, 12, 6, @on

    exec sp_trace_setevent @TraceID, 12, 10, @on

    exec sp_trace_setevent @TraceID, 12, 14, @on

    exec sp_trace_setevent @TraceID, 12, 18, @on

    exec sp_trace_setevent @TraceID, 12, 11, @on

    exec sp_trace_setevent @TraceID, 12, 12, @on

    exec sp_trace_setevent @TraceID, 12, 13, @on

    exec sp_trace_setevent @TraceID, 13, 1, @on

    exec sp_trace_setevent @TraceID, 13, 9, @on

    exec sp_trace_setevent @TraceID, 13, 6, @on

    exec sp_trace_setevent @TraceID, 13, 10, @on

    exec sp_trace_setevent @TraceID, 13, 14, @on

    exec sp_trace_setevent @TraceID, 13, 11, @on

    exec sp_trace_setevent @TraceID, 13, 12, @on

    --> Using your saved trace file, add the '-- Set the Filters' section below <--

    declare @intfilter int

    declare @bigintfilter bigint

    exec sp_trace_setfilter @TraceID, 10, 0, 7, N'SQL Server Profiler - b7e10d24-0864-4609-8149-58bd0dc813d7'

    exec sp_trace_setfilter @TraceID, 11, 0, 6, N'MGH\adtnotices'

    --> Customization is now completed <--

    -----------------------------------------------------------------------------

    -- This filter is added to exclude all profiler traces.

    exec sp_trace_setfilter @TraceID, 10, 0, 7, N'SQL Profiler%'

    -- Set the trace status to start

    exec sp_trace_setstatus @TraceID, 1 -- start trace

    select 'Trace id = ', @TraceID, 'Path=', @Folder+@StartDatetime+'\'

    select 'To Stop this trace sooner, execute these two commands'

    select ' EXEC sp_trace_setstatus @traceid = ' , @TraceID , ', @status = 0; -- Stop/pause Trace'

    select ' EXEC sp_trace_setstatus @traceid = ' , @TraceID , ', @status = 2; -- Close trace and delete it from the server'

    return

  • Additional information, I meant to say that the trace is filtered on a single user login.

    Thanks again.

  • Denise,

    It like your issue is here:

    exec sp_trace_setfilter @TraceID, 10, 0, 7, N'SQL Server Profiler - b7e10d24-0864-4609-8149-58bd0dc813d7'

    exec sp_trace_setfilter @TraceID, 11, 0, 6, N'MGH\adtnotices'

    --> Customization is now completed <--

    -----------------------------------------------------------------------------

    -- This filter is added to exclude all profiler traces.

    exec sp_trace_setfilter @TraceID, 10, 0, 7, N'SQL Profiler%'

    I'd take the bolded, italicized code and move it up with the first filter because they are both filtering on column 10 so they need to be grouped together because the 4th parameter is the AND/OR for filtering so they need to be together.

  • I tried that but still had the error. So I commented out the first filter line assuming the last one covered it as well.

    --exec sp_trace_setfilter @TraceID, 10, 0, 7, N'SQL Server Profiler - b7e10d24-0864-4609-8149-58bd0dc813d7'

    exec sp_trace_setfilter @TraceID, 11, 0, 6, N'MGH\adtnotices'

    exec sp_trace_setfilter @TraceID, 10, 0, 7, N'SQL Profiler%'

    And then it ran without the error. This was my first attempt at creating a scheduled trace and I had no idea what to do. So thank you very much for your help.

Viewing 7 posts - 1 through 6 (of 6 total)

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