Home Forums Programming General RAISERROR failed due to invalid parameter substitution(s) RE: RAISERROR failed due to invalid parameter substitution(s)

  • Somewhere in your code you are using the RAISERROR command and you are not supplying the correct parameters to the error string. 

    RAISERROR ('The level for job_id:%d should be between %d and %d.',

          16, 1, @@JOB_ID, @@MIN_LVL, @@MAX_LVL)

    In the above example, the parameters @@JOB_ID, @@MIN_LVL, @@MAXLVL will be inserted into the error string 'The level...' in place of the parameter placeholders %d, %d and %d respectively.

    To get your error, you have omited a parameter, or are using the incorrect format (e.g. string instead of int).

    You can also use predefined messages that are stored in sysmessages.  If you are doing so, 'SELECT from sysmessages WHERE error = msg_id' where Msg_id is the number you are using in your RAISERROR as follows:

    RAISERROR(msg_id, 16, 1, parameters)

    Check that you are passing the correct parameters to the msg_id, and that they are on the correct format:

    %d or %i = signed integer

    %o = unsigned octal

    %p = pointer

    %s = string

    %u = unsigned integer

    %x or %X = unsigned hexadecimal

     

     


    When in doubt - test, test, test!

    Wayne