Thursday , April 25 2024

SET LOCK_TIMEOUT and @@LOCK_TIMEOUT Function in SQL Server(TSQL)

 

With SET LOCK_TIMEOUT, we can set the maximum amount of time a session will wait to access a blocked resource in milliseconds. If a query waits until this time in the session, the query will be canceled and it will return the information about cancel process.

With the @@LOCK_TIMEOUT function, we can query the LOCK_TIMEOUT setting of the corresponding session.

If @@LOCK_TIMEOUT is not set for a session, it will return -1 when we query @@LOCK_TIMEOUT.

We can use SET LOCK_TIMEOUT and @@ LOCK_TIMEOUT as follows:

 

Loading

About dbtut

We are a team with over 10 years of database management and BI experience. Our Expertises: Oracle, SQL Server, PostgreSQL, MySQL, MongoDB, Elasticsearch, Kibana, Grafana.

Leave a Reply

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

Categories