{"id":207,"date":"2012-05-16T07:12:55","date_gmt":"2012-05-16T07:12:55","guid":{"rendered":"https:\/\/sqlserverlearner.azurewebsites.net\/2012\/05\/16\/using-lock_timeout\/"},"modified":"2012-05-16T07:12:55","modified_gmt":"2012-05-16T07:12:55","slug":"using-lock_timeout","status":"publish","type":"post","link":"https:\/\/sqlserverlearner.com\/2012\/05\/16\/using-lock_timeout\/","title":{"rendered":"Using @@LOCK_TIMEOUT"},"content":{"rendered":"
@@LOCK_TIMEOUT specifies the number of milliseconds a statement has to wait for the lock on the dependant objects to be released.<\/p>\n
Syntax: <\/strong> Example:<\/strong> By default the initial value of @@LOCK_TIMEOUT is -1.<\/p>\n @@LOCK_TIMEOUT setting is not applicable to the following:
\n[sql]
\nSET @@LOCK_TIMEOUT [time_out_in_milli_seconds]
\n[\/sql]<\/p>\n
\nBelow example sets the lock timeout to 2000 milli seconds(2 seconds).
\n[sql]
\nSET @@LOCK_TIMEOUT 2000
\n[\/sql]<\/p>\n
\n CREATE DATABASE Statement
\n ALTER DATABASE Statement
\n DROP DATABASE Statement<\/p>\n