In this tip we take a closer look at how this works and what the issues maybe when using NOLOCK.
Let's walk through some simple examples to see how this works.
- Flash chat hookup
- on dating older women
- Adult bl chat room sex srx
- todosey dating
- Free adult mobile za
- best skype dating sites
(These queries are run against the Adventure Works database.) Here is a query that returns all of the data from the Person. If I run this query I can see there is only one record that has a Suffix value for Contact ID = 12.
If I run sp_who2 I can see that the SELECT statement is being blocked.
To get around the locked records, I can use the NOLOCK hint as shown below and the query will complete even though the query in window 1 is still running and has not been committed or rolled back.
If you notice below the Suffix column now has "B" for all records.
Can you explain the what NOLOCK does and whether this is a good practice or not?
It seems that in some SQL Server shops the use of the NOLOCK (aka READUNCOMMITED) hint is used throughout the application.This is because the UPDATE in window 1 updated these records.Even though that transaction has not been committed, since we are using the NOLOCK hint SQL Server ignores the locks and returns the data.If the UPDATE is rolled back the data will revert back to what it looked like before, so this is considered a Dirty Read because this data may or may not exist depending on the final outcome in query window 1.I will need to either cancel this query or COMMIT or ROLLBACK the query in window one for this to complete.For this example I am going to cancel the SELECT query.