Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
yhchan2005
Starting Member
26 Posts |
Posted - 2010-10-14 : 22:49:36
|
Refer to below SQL scriptSelect Field1, Field2, ( Select Field99 from Table3 with (NoLock) Where .... ) Field3 from Table1 with (NOLock)Inner Join Table2 with (NoLock) ON.....Where ...... Do we need to put in the (NoLock) for subquery and inner join / left jonif we have put in the (Nolock) in main query ???? |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
Kristen
Test
22859 Posts |
Posted - 2010-10-15 : 03:00:16
|
NOLOCK means you will get the same record repeated twice in the resultset; some rows will not appear at all; plus you will get data included which is subsequently rolled back, or further modified by a trigger.These things will happen very infrequently, and be extremely difficult to recreate in a DEV / TEST / QA environment; if the data is used for business decisions it may have catastrophic consequences for the business.If all that is OK (for example, we ONLY use NOLOCK for DBAs to interrogate LOG tables that are being heavily written to) then fine. If not then don't use it!As Tara says READ_COMMITTED_SNAPSHOT is probably what you need, particularly if you have READS blocking WRITES. |
 |
|
GilaMonster
Master Smack Fu Yak Hacker
4507 Posts |
Posted - 2010-10-15 : 04:31:19
|
Is inconsistent and possibly incorrect data acceptable?See - [url]http://sqlblog.com/blogs/andrew_kelly/archive/2009/04/10/how-dirty-are-your-reads.aspx[/url]--Gail ShawSQL Server MVP |
 |
|
|
|
|