In sqlserver, how does raiserror roll back the transaction?

Source: Internet
Author: User
In the sub-stored procedure, a custom error is displayed in the form of raiserror (msg,). An error is displayed in the parent stored procedure, however, the parent transaction is not rolled back during execution. What other configurations do I need? If an error occurs in sub-Stored Procedure 1, an error is output, but the primary stored procedure is not rolled back. 1begintran23

In the sub-stored procedure, a custom error is displayed in the form of raiserror ('msg ',). An error is displayed in the parent stored procedure, however, the parent transaction is not rolled back during execution. What other configurations do I need? If an error occurs in sub-Stored Procedure 1, an error is output, but the primary stored procedure is not rolled back. 1 begin tran 2 3

In the sub-storage process, a custom error is displayed in the form of raiserror ('msg,

An error is displayed in the parent stored procedure, but the parent-level data is not rolled back during execution.TransactionsIs any other configuration required?

If an error occurs in sub-Stored Procedure 1, an error is output, but the primary stored procedure is not rolled back.

1 begin tran 2 3 exec sub-Stored Procedure 1 4 exec sub-Stored Procedure 2 5 exec sub-stored procedure 3 6 exec sub-Stored Procedure 4 7 8 if @ error <> 0 9 rollback tran10 else11 commit tran

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.