Feature description for "Lock options" in SELECT statements
SQL Server provides a powerful and complete locking mechanism to help achieve the concurrency and high performance of the database system. Users can use the default settings of SQL Server or use the lock options in the SELECT statement to achieve the desired effect.
This article describes each of the "lock options" in the SELECT statement and the corresponding feature descriptions.
Function Description:
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 back), known as "dirty data."
HOLDLOCK (Hold Lock)
When this option is selected, SQL Server will persist this shared lock to the end of the entire transaction and will not be released on the way.
UPDLOCK (Modify Lock)
When this option is selected, SQL Server uses a modify lock instead of a shared lock when reading data, and holds the lock to the entire transaction or to the end of the command. Using this option ensures that multiple processes can read data at the same time, but only that process can modify the data.
TABLOCK (table Lock)
When this option is selected, SQL Server will place a shared lock on the entire table until the command ends.
This option ensures that other processes can read only and cannot modify the data.
Paglock (page lock)
This option is the default option when SQL Server uses a shared page lock when it is selected.
Tablockx (Row it table lock)
When this option is selected, SQL Server will place an exclusive lock on the entire table until the command or transaction ends. This prevents other processes from reading or modifying the data in the table.
Using these options will cause the system to ignore the transaction isolation level (Transaction isolation levels) that was originally set in the SET statement.
Please consult the SQL Server online manual for more information.
http://www.bkjia.com/PHPjc/631183.html www.bkjia.com true http://www.bkjia.com/PHPjc/631183.html techarticle The "Lock Options" feature in the SELECT statement shows that SQL Server provides a powerful and complete locking mechanism to help achieve the concurrency and high performance of the database system. Users can both use the SQL Server ...