Error Handling of nested transactions and transaction retention points
For nested transactions.1. Start external transactions, start internal transactions, and try catchInternal error: if an internal transaction error occurs, internal and
BEGIN TRANSACTIONMarks the starting point for an explicit local transaction. BEGIN TRANSACTION The @ @TRANCOUNT by 1 increments.BEGIN TRANSACTION represents a point where data referenced by a connection is logically and physically consistent at that
After careful study, it is still a bit complicated to find the explicit transaction (display transaction) inside SQL Server. Here are some summaries:Commit TRANSACTION commits all nested transaction modifications. However, if the nested transaction
The Begin Tran,commit Tran and rollback TRAN are available in SQL Server 2005/2008 to use transactions.Begin TRAN Indicates the start of a transaction,Commit Tran represents the commit transaction,Rollback TRAN means rolling things backEXEC
Reprinted from: http://blog.csdn.net/leshami/article/details/5731158One, rollback (ROLLBACK) and undo (undo)Rollback and roll forward are important means of ensuring that the data in an Oracle database is in a consistent state. --Before the 9i
Turn from: Nested transactions in SQL Server use--transaction count indicates a mismatch between the number of BEGIN and COMMIT statements--The underlying problemProblem:1. System.Data.SqlClient.SqlException (0x80131904): The transaction count after
SQL Server 2005/2008 provides begin Tran, commit Tran, and rollback Tran to use transactions. Begin Tran indicates that the transaction starts, commit Tran indicates that the transaction is committed, and rollback Tran indicates that the transaction
The specific usage is as follows:
Copy Code code as follows:
-- =============================================
--Author:cynimoon
--Create date:2009-10-09
--Description: sample Stored Procedure
-- ======================================
begin Try -- endbegin--SQL (handle error action)end CatchWe're going to write the SQL that might go wrong between the begin try...end try, and if something goes wrong, just the program jumps to the beign catch...end catch immediately following the
Start transaction, commit and rollback syntaxStart Transaction | Begin [Work]commit [Work] [and [No] chain] [[No] release]rollback [work] [and [No] chain] [[No] release]set autocommit = { 0 | The 1}start transaction or BEGIN statement can begin a
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.