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
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
-- ======================================
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
Tran two ways of writing in SQLThe first form of a try catch:BeginTRYBegin Tran Transaction DECLARE @ServiceOrderId INT SET @ServiceOrderId=73342 DECLARE @ErrorCount INT SET @ErrorCount = 0 --Adjust the
-- Typical transaction programming example
-- Begin transaction is the start transaction, commit transaction is the commit transaction, and rollback transaction is the rollback transaction
-- In this example, insert a record first. If an error
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
MS SQL Server Query optimization methodThere are many reasons for the slow speed of queries, which are common1, no indexes, or no indexes (this is the most common problem with query slowness, is the flaw in programming)2, I/o throughput is small,
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
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.