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
-- ======================================
From: http://blog.csdn.net/missmecn/archive/2008/10/06/3019798.aspx related articles:
MySQL database lock
Several lock modes in Oracle
Recommendation circle:Pipboy More related recommendations
The Study of the lock mechanism requires two
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
Lock mechanismThe difference between Nolock and Readpast.
1. Open a transaction to perform the Insert data operation.
BEGIN TRAN t
INSERT into Customer
SELECT ' A ', ' a '
2. Execute a query statement.
SELECT * from
How to lock a row table database 1 how to lock a row of a table
SET transaction isolation level read uncommitted
Select * from Table rowlock where id = 1
2. Lock a table in the database
Select * from table with (holdlock)
Lock
In-depth analysis of the transaction isolation level and lock mechanism in the MSSQL database, in-depth analysis of mssql
Lock MechanismThe difference between NOLOCK and READPAST.
1. Start a transaction to insert data.
BEGIN TRAN tINSERT INTO
The usage is as follows:Copy codeThe Code is as follows:-- ===================================================== ======-- Author: cynimoon-- Create date: 2009-10-09-- Description: sample stored procedure-- ============================================
A database is a shared resource used by multiple users, just like an operating system. When multiple users access data concurrently, multiple transactions can access the same data simultaneously in the database. If concurrent operations are not
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
NOLOCK (without lock)When this option is selected, SQL Server does not add any locks when reading or modifying data. In this case, it is possible for the user to read the data in the incomplete transaction (uncommited Transaction) or rollback (roll
Document directory
2.1 How does the nested transaction roll back the outermost transaction affect the internal transaction?
2.2 How about nested transactions roll back internal nested transactions?
Save transaction rollback point-you can select
SELECT * FROM dbo. AaSELECT * FROM dbo. B--1. Exclusive lock--no changes or additions to the search.-This is the database itself, in order to appear data confusion, dirty data processing mechanism of their own--Connection 1BEGIN TranUPDATE dbo. BSet
The Study of the lock mechanism requires two conditions: 1. Large Data Volume 2. If multiple concurrent users lack these two conditions, the database is not prone to deadlock. It may take half the effort for research. If both conditions are met, but
1. Handle deadlocks and set deadlock priority
A deadlock occurs when multiple users apply for different blockages. The applicant has part of the blockages and waits for the blockages of other users.
Set deadlock_priority can be used to control
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
How to handle massive Concurrent Data Operations
File Cache, database cache, optimized SQL, data shunting, horizontal and vertical division of database tables, and optimized code structure!
Summary of lock statements
I. Why should I introduce
(1) usage of Scheduler
When multiple users perform concurrent operations on the database, the following data inconsistency occurs:
(1) lost updatesA and B read and modify the same data. The Modification result of one user destroys the Modification
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.