Home Forums SQL Server 2005 Development Try Catch alters behaviour of existing procedures RE: Try Catch alters behaviour of existing procedures

  • I understand. But you have control of the behavior based on the error severity level.

    From Books Online (the section on RAISERROR):

    When RAISERROR is run with a severity of 11 or higher in a TRY block, it transfers control to the associated CATCH block. The error is returned to the caller if RAISERROR is run:

    Outside the scope of any TRY block.

    With a severity of 10 or lower in a TRY block.

    With a severity of 20 or higher that terminates the database connection.

    In your example, change the error severity to 9 instead of 16 and you get the consistent behavior you are after. The various behaviors based on error severity are by design. In some cases a procedure cannot and should not proceed after a severe error.

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills