error in store proc

  • I have a sql stored procedure with a few input paramerters. I am inserting in the datatabase these values which are NOT NULL values

    But if 1 of the values is passed to the stored proc as null I need to catch what the error is and throw back that error to the client from the store proc

    How can I do this?

  • if @parm1 is null

     begin

     raiserror('null values not allowed, parm1 is null', 16, 1)

     goto xit

     end

    -- at the end of the proc....

    xit:

    return 9

    -- or some other number defined to your

    -- client application as a parameter error.

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

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