如何为所有表的存储过程T-SQL放置NO LOCK

时间:2022-02-03 10:57:23

I want that my tables will not be locked. Is it possible to set NO LOCK for all tables in the stored procedure. What is the best way if I have a lot of tables like this:

我希望我的桌子不会被锁定。是否可以为存储过程中的所有表设置NO LOCK。如果我有很多像这样的表,最好的方法是什么:

select * from t1
join t2 ..
join t3 .. with (nolock)

select * from t4
join t4 ..
join t5 etc...
 with (nolock)

1 个解决方案

#1


29  

You can set this at the query level:

您可以在查询级别设置:

SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED

Like NOLOCK, this allows for dirty reads.

像NOLOCK一样,这允许脏读。

#1


29  

You can set this at the query level:

您可以在查询级别设置:

SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED

Like NOLOCK, this allows for dirty reads.

像NOLOCK一样,这允许脏读。