Using @@LOCK_TIMEOUT

@@LOCK_TIMEOUT specifies the number of milliseconds a statement has to wait for the lock on the dependant objects to be released.

Syntax:
[sql]
SET @@LOCK_TIMEOUT [time_out_in_milli_seconds]
[/sql]

Example:
Below example sets the lock timeout to 2000 milli seconds(2 seconds).
[sql]
SET @@LOCK_TIMEOUT 2000
[/sql]

By default the initial value of @@LOCK_TIMEOUT is -1.

@@LOCK_TIMEOUT setting is not applicable to the following:
CREATE DATABASE Statement
ALTER DATABASE Statement
DROP DATABASE Statement

MSDN Link: http://msdn.microsoft.com/en-us/library/ms189470.aspx

Applicable to SQL Server 2000,SQL Server 2005,SQL Server 2008,SQL Server 2008 r2,SQL Server 2012

Leave a Reply

Your email address will not be published. Required fields are marked *