是否可以在事务中释放某个表的锁?
这是一个例子:
查询窗口1:
BEGIN TRAN
UPDATE table_1 SET col_1 = '1' WHERE ID = 1
-- loop update (this takes time)
WHILE EXISTS (SELECT * FROM table_2 WHERE col_1 = 'a')
BEGIN
UPDATE table_2 SET col_1 = 'b' WHERE col_1 = 'a'
END
COMMIT TRAN
查询窗口2:
SELECT * FROM table_1 WHERE ID = 1
当窗口1中的事务仍在运行时,可以访问table_1吗?
答案 0 :(得分:1)
您可以使用提示 https://stackoverflow.com/questions/41601680/wldeploy-on-all-files-in-deployment-folder/41621500#41621500
:
NOLOCK
了解更多here。