SQL Server Locks Question:
Download Job Interview Questions and Answers PDF
What is SQL Server locking?
Answer:
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
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
Download MS SQL Server Locks Interview Questions And Answers
PDF
Previous Question | Next Question |
What is a live lock? | Explain what is lock escalation and what is its purpose? |