如何设定MS SQL SERVER Lock 的返回时间?

1.use below sql can get lock message:
sp_lock
select * from syslockinfo
2.set the lock timeout
for example:
one seccion:
select * from sales (xlock) where stor_id=6380 and ord_num='6871'
two session
set lock_timeout -1
go
select * from sales
where stor_id=6380 and ord_num='6871'
the two session will wait for the one session release the record.
then change the lock_timeout values:
set lock_timeout 10
go
select * from sales
where stor_id=6380 and ord_num='6871'
the two session will wait 10ms then return error message to client.

remark:
See the current lock_timeout values
select @@lock_timeout

Published At
Categories with 数据库类
Tagged with
comments powered by Disqus