• Ol'SureHand (11/4/2009)


    IMHO, the backup will happen regardless of whether or not the CATCH block is executed (i.e. regardless of DBCC raising an error).

    That is because the BACKUP command comes AFTER the END CATCH ....

    What is the purpose of the TRY/CATCH block if not to avoid crashing an execution sequence?

    There is the RETURN statement after the RAISERROR:

    RAISERROR(@ErrorMessage, @ErrorSeverity, @ErrorState)

    RETURN

    This will interrupt the batch execution. See the link http://msdn.microsoft.com/en-us/library/ms174998.aspx:

    RETURN is immediate and complete and can be used at any point to exit from a procedure, batch, or statement block. Statements that follow RETURN are not executed.