Question about this error Procedure expects parameter '@traceid' of type 'int'

  • I'am running this and getting an error. Help appreciated

    DECLARE @trace_ID int , @path_file nvarchar(200)

    --SELECT @path_file=output_path_file FROM table WHERE tid = 1

    --SELECT @trace_ID = traceid

    --FROM ::fn_trace_getinfo(0)

    --WHERE property = 2

    --AND value = @path_file

    EXEC sp_trace_setstatus @trace_ID,0--<< stop ---- I believe the error is here

    EXEC sp_trace_setstatus @trace_ID,2--<< Close

    Msg 214, Level 16, State 5, Procedure sp_trace_setstatus, Line 1

    Procedure expects parameter '@traceid' of type 'int'

    I tried this also

    EXEC sp_trace_setstatus '@trace_ID + CAST(varchar,id) + ', 0

    EXEC sp_trace_setstatus '@trace_ID + CAST(varchar,id) + ', 2

    Thanks in advance

  • Try this ..

    declare @trace_id INT

    select @trace_id = 0

    select @trace_id = traceid

    from ::fn_trace_getinfo (NULL)

    -- where value = 'D:\Server_TraceFiles\trace\profiler.trc' (Modify This )

    EXEC master..sp_trace_setstatus @traceid = @trace_id ,@status = 0

    -- Closes the specified trace and deletes its definition from the server.

    EXEC master..sp_trace_setstatus @traceid = @trace_id ,@status = 2

    --

    SQLBuddy

Viewing 2 posts - 1 through 1 (of 1 total)

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