Calling extended stored procedure - unexpected behavior

  • Why does the followihng not work:

    declare @trace_handle int

    EXEC sp_trace_create @trace_handle OUTPUT, 2, N'c:\traces\trace', 10

    but this does:

    declare @trace_handle int

    declare @maxfs bigint

    set @maxfs = 10

    exec sp_trace_create @trace_handle OUTPUT, 2, n'c:\traces\trace', @maxfs

  • Per BOL

    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 will return an error.

    when you call it with 10 I beleive that is being passed as an int, when you use a variable declared as a bigint, it is passed as a bigint.

    The 10 would probably work if you did this...

    declare @trace_handle int

    EXEC sp_trace_create @trace_handle OUTPUT, 2, N'c:\traces\trace', convert(bigint, 10)

    To help us help you read this[/url]For better help with performance problems please read this[/url]

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

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