SET LOCK_TIMEOUT (Transact-SQL)
Specifies the number of milliseconds a statement waits for a lock to be released.
Applies to: SQL Server (SQL Server 2008 through current version), Azure SQL Database.
At the beginning of a connection, this setting has a value of -1. After it is changed, the new setting stays in effect for the remainder of the connection.
The setting of SET LOCK_TIMEOUT is set at execute or run time and not at parse time.
The READPAST locking hint provides an alternative to this SET option.
CREATE DATABASE, ALTER DATABASE, and DROP DATABASE statements do not honor the SET LOCK_TIMEOUT setting.
The following example sets the lock time-out period to 1800 milliseconds.
SET LOCK_TIMEOUT 1800; GO