假如現在使用到N個表格需要加上N個 with (nolock)
,像是
select * from T1 with (nolock)
join T2 with (nolock) ..
join T3 with (nolock) ..
join T4 with (nolock) ..
....
想宣告一次就能讓接下來查詢都有 with (nolock)
效果
set Transaction isolation level read uncommitted
查詢前先設定,查詢就不用再加上 with (nolock)
只是若資料在別的交易rollback後,而你先query出來,會導致你的資料不是正確的