sp_create_trace script

  • I've put together a trace script and I'm getting a confusing error. After the sp_trace_setevent's, I have a filter to get event 10 RPC:Completed and 12 SQL:BatchCompleted where duration > 60000ms

    declare @bigintfilter bigint

    set @bigintfilter = 60000

    exec sp_trace_setfilter @traceID, 10, 13, 4, @bigintfilter

    exec sp_trace_setfilter @traceID, 12, 13, 4, @bigintfilter

    Then I get this error: Procedure expects parameter '@value' of type 'nvarchar(256)'

    Any ideas?

    There is an exception to every rule, except this one...

  • Check the data type for your last parameter, per the link below it needs to match the value in the trace that you are looking up (which in this case appears to be nvarchar()...trying changing from bigint to nvarchar()

    http://technet.microsoft.com/en-us/library/ms174404.aspx

    ______________________________________________________________________________Never argue with an idiot; Theyll drag you down to their level and beat you with experience

  • MyDoggieJessie (3/5/2014)


    Check the data type for your last parameter, per the link below it needs to match the value in the trace that you are looking up (which in this case appears to be nvarchar()...trying changing from bigint to nvarchar()

    http://technet.microsoft.com/en-us/library/ms174404.aspx%5B/quote%5D

    Thanks for the reply. I tried that, but it asked for int instead. :pinch:

    There is an exception to every rule, except this one...

  • Weird. Have you tried just using an int?

    "Parameters of all SQL Trace stored procedures (sp_trace_xx) are strictly typed. If these parameters are not called with the correct input parameter data types, as specified in the argument description, the stored procedure returns an error."

    ______________________________________________________________________________Never argue with an idiot; Theyll drag you down to their level and beat you with experience

  • Yep, every data type I try it tells me to try another. I try int it tells me nvarchar, I try nvarchar it tells me int, grrrrrr.

    There is an exception to every rule, except this one...

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

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