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 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
The specific usage is as follows:
Copy Code code as follows:
-- =============================================
--Author:cynimoon
--Create date:2009-10-09
--Description: sample Stored Procedure
-- ======================================
The usage is as follows:Copy codeThe Code is as follows:-- ===================================================== ======-- Author: cynimoon-- Create date: 2009-10-09-- Description: sample stored procedure-- ============================================
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
Atitit... trigger Mechanism ltriggermechanic ismsumup. o8f1. trigger Type 12. implementation Principle 13. after trigger VsInsteadOf trigger 14. DML trigger VsDDL trigger 35. trigger and transaction 36. the following describes the transactions in
Atitit... Summary of the trigger mechanism ltrigger mechanic sumup. O8f, ltriggero8f
Atitit... Summary of the trigger mechanism ltrigger mechanic sumup. O8f
1. Trigger type 1
2. Implementation Principle 1
3. After trigger Vs Instead Of trigger 1
4.
Related SQL statements:
Begin tran
Save tran
Commit tran
Rollback tran
Nested transaction example:
Begin Tran tran1
Begin Tran tran2
Commit Tran can specify a transaction name separately, such as tran1 and tran2. In fact, it has no effect. Even if
Here are a few of my statistical options:
first Scenario (recursive):
The simple table structure is:
CategoryID Int (4),
CategoryName nvarchar (50),
ParentID Int (4),
Depth Int (4)
In this way, according to the parentid level of the use of
There are many infinite classification types on the network, but there are only two types: recursive algorithm and non-recursive algorithm ..
There are many infinite classification types on the network, but there are only two types: recursive
Here are a few of my statistical options:
first Scenario (recursive):
The simple table structure is:
CategoryID Int (4),
CategoryName nvarchar (50),
ParentID Int (4),
Depth Int (4)
In this way, according to the parentid level of the use of
Alter proc proc_updateinfomation (@ c_id varchar (50), @ State int output)
As
Begin
Declare @ Tran varchar (50)
Set @ State = 0
Begin Tran @ tran
Delete from companyinfo where c_id = @ c_id
If @ error0 or @ rowcount> 1
Begin
Rollback Tran @ tran
Set
Strictly speaking, these three production methods have certain intersections, and their positioning methods will be explained below
Strictly speaking, these three production methods have certain intersections, and their positioning methods will be
Transactions are used in the stored procedure. transactions are used in the stored procedure.
I. Simple Syntax of transactions used in Stored Procedures
It is very important to use transactions in the stored procedure. Using data can maintain the
simple syntax for using transactions in a stored procedureWhen using transactions in a stored procedure, it is important to use the data to maintain the associated integrity of the data, and it is simple to use the transaction in a SQL Server stored
1. What is a transaction: a transaction is an indivisible working logical unit that is used as the smallest control unit when performing concurrent operations on a database system. All of the database operations commands he contains are either
Primary keys are generated in three main ways:
A. Automatic database generation
Two. GUID
Three. Development and Creation
Strictly speaking, these three kinds of production methods have a certain intersection point, its positioning mode will be
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
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 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.