Sql server - Describe in brief SQL Server locking

Describe in brief SQL Server locking.

SQL Server has 3 main lock types:
- Shared: Locks are compatible with other shared and update locks.
- Update: Locks are compatible with shared locks.
- Exclusive: Locks are not compatible with any other locks.

Apart from lock types, there are transaction isolation levels for managing security among transactions:
- READ UNCOMMITTED
- READ COMMITTED
- REPEATABLE READ
- SERIALIZABLE

SQL Server has some locking optimizer hints along with lock types:
- NOLOCK
- HOLDLOCK
- UPDLOCK
- TABLOCK
- PAGLOCK
- TABLOCKX
- READCOMMITTED
- READUNCOMMITTED
- REPEATABLEREAD
- SERIALIZABLE
- READPAST
- ROWLOCK

Describe in brief SQL Server locking.

SQL server has a locking mechanism which locks the resources to be used by transactions. This is an automatic mechanism. Different modes are used for locking. Locking at a lower granularity would mean locking rows while locking at a higher granularity would mean locking tables.
Sql server - What are the different types of lock modes in SQL Server 2000?
Shared (S): Mostly used for Read only operations like SELECT statements. It allows concurrent transactions to read data........
Sql server - What is lock escalation? What is its purpose?
Lock escalation is when the system combines multiple locks into a higher level one........
Sql server - What is a live lock?
A live lock is similar to a deadlock that the states of the processes involved in the live lock........
Post your comment