{"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>
\n[sql]
\nSET @@LOCK_TIMEOUT [time_out_in_milli_seconds]
\n[\/sql]<\/p>\n

Example:<\/strong>
\nBelow example sets the lock timeout to 2000 milli seconds(2 seconds).
\n[sql]
\nSET @@LOCK_TIMEOUT 2000
\n[\/sql]<\/p>\n

By default the initial value of @@LOCK_TIMEOUT is -1.<\/p>\n

@@LOCK_TIMEOUT setting is not applicable to the following:
\n CREATE DATABASE Statement
\n ALTER DATABASE Statement
\n DROP DATABASE Statement<\/p>\n

MSDN Link: http:\/\/msdn.microsoft.com\/en-us\/library\/ms189470.aspx<\/a><\/p>\n

Applicable to SQL Server 2000,SQL Server 2005,SQL Server 2008,SQL Server 2008 r2,SQL Server 2012<\/p>\n","protected":false},"excerpt":{"rendered":"

@@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…<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[1959,1960,1961,1962,1963,1964,1965,1966,1967],"_links":{"self":[{"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/posts\/207"}],"collection":[{"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/comments?post=207"}],"version-history":[{"count":0,"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/posts\/207\/revisions"}],"wp:attachment":[{"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/media?parent=207"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/categories?post=207"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/tags?post=207"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}