|
|
Question : MS-SQL 2000 LOCK_TIMEOUT
|
|
Hi, is there a way to set LOCK_TIMEOUT in MS-SQL2000? What I did was I issued the following command in Microsoft SQL Enterprise Manager: SET LOCK_TIMEOUT 60000 GO After that I did a select statement 'select @@LOCK_TIMEOUT' and I saw it changed the value, but when I exited Enterprise Manager, a default value = -1 come back. My question is, is that possible to change a default value of @@LOCK_TIMEOUT? If possible then how to do it, please help.
Thanks,
HN
|
Answer : MS-SQL 2000 LOCK_TIMEOUT
|
|
Hi ,
It is a connection specific setting. So when you disconnect and connect again it defaults to -1. But use it with caution. The frontend application must explicitly handle the error message thrown out by this setting.
This error doesn't automatically roll back a transaction. So if SQL Server reaches its lock timeout value, it stops trying to modify rows in the current table and moves on to the next statement. Instead of the transaction being an atomic, all-or-nothing operation, you might be left with part of the transaction incompletely executed. If you want the transaction to be all-or-nothing, you need to include a specific test for error 1222, and include an explicit ROLLBACK TRANSACTION as the action to perform when the error is encountered. You might consider adding this test to all data-modification statements in applications that adjust the LOCK_TIMEOUT value. This test is the only way to guarantee that the transactions maintain their consistency.
Thanks, Rajesh.
|
|
|
|
|