开发者

Do table hints apply to all tables or only the preceding table?

开发者 https://www.devze.com 2023-03-05 06:22 出处:网络
If I have select * from table开发者_运维问答A, tableB with (nolock) does the nolock hint apply to tableB, or does it apply to both tables? Do I need to do

If I have

select * from table开发者_运维问答A, tableB with (nolock)

does the nolock hint apply to tableB, or does it apply to both tables? Do I need to do

select * from tableA with (nolock), tableB with (nolock)

for the hint to apply to both tables?


Table hints only apply to the preceeding table. You need to do

select * from tableA with (nolock), tableB with (nolock)


Yes. Table Hints only apply to the preceding table. To set this for all tables in the query you could do.

SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED

NOLOCK / READ UNCOMMITTED can cause inconsistent results however. Have you considered RCSI instead?

0

精彩评论

暂无评论...
验证码 换一张
取 消