NoLock and ReadUncommitted both are same. Both of it will leads to bad data being returned …!!!
Mostly, we are able to see ‘WITH (NOLOCK)’ next to table name,only to avoid the deadlock in SQL and result the query fast.
Suppose, if we have 20 tables in the query, each are joining with each other.
Then without thinking we starts adding the ‘WITH (NOLOCK)’.
We can also add ‘WITH (READUNCOMMITTED)’ next to table name.
SELECT * From TableAAA WITH(NOLOCK)
SELECT * From TableBBB WITH(READUNCOMMITTED)
If both reserved keyword having the same functionality and result, then why ‘READUNCOMMITTED’ introduced.
Inspite of being adding ‘WITH (NOLOCK)’ after each of the table. Simply set the isolation level to Readuncommitted for that specific connection.
SET TRANSACTION ISOLATION LEVEL READUNCOMMITTED
SELECT * From TableAAA
SELECT * From TableBBB
Don’t need to write WITH(NOLOCK) and WITH(READUNCOMMITTED) in each statement.
For more info read atMSDN