Ispirer Website Ispirer Capabilities - Microsoft SQL Server Migration Free Trial

SQL Server - SET LOCK_TIMEOUT Statement

SQL Server - SET LOCK_TIMEOUT Statement
Syntax SET LOCK_TIMEOUT milliseconds
Description SET LOCK_TIMEOUT defines how to handle a process that tries to access a locked row or table.

-1 - the server waits forever (no timeout). This is the default behavior for locking.
0 - the server ends the operation immediately and returns an error.
milliseconds - waits the specified number of milliseconds and returns an error code if the lock not released.

Examples:

SET LOCK_TIMEOUT 0         -- returns an error immediately if a resource locked     
SET LOCK_TIMEOUT -1        -- wait until the lock releases
SET LOCK_TIMEOUT 31000     -- wait no more than 31 seconds until the lock releases

Equivalents in Other Databases

Database Equivalent Notes
Informix SET LOCK MODE Statement Time in seconds, default is NO WAIT (timeout is 0)

© 1999-2024, Ispirer Systems, LLC. All Rights Reserved.