MSSQLMSSQL 1222
MSSQL 1222: Lock Request Time Out Period Exceeded
SQL Server error 1222 is raised when a statement cannot acquire a lock within the time defined by SET LOCK_TIMEOUT. The statement is aborted but the transaction is not automatically rolled back.
Example Query
SET LOCK_TIMEOUT 1000; -- 1 second SELECT * FROM orders WITH (UPDLOCK) WHERE id = 1; -- Times out if another session holds the lock
Common Causes
- 1Another session holding a lock on the required resource for too long
- 2LOCK_TIMEOUT set very low in the session
- 3Blocking chain where multiple sessions wait on a single blocker
How to Fix It
Identify blockers with SELECT * FROM sys.dm_exec_requests WHERE blocking_session_id <> 0. Use READ COMMITTED SNAPSHOT ISOLATION (RCSI) to eliminate reader-writer blocking. Optimise long transactions to release locks faster.
Need a reliable database?
Try Supabase — free PostgreSQL with a generous free tier. No credit card required.
Got a query causing this error?
Paste it into SQLbuddy and get an instant plain-English explanation with optimization tips.
Analyze My Query →