Skip to main content
     


What is the difference between NOLOCK and READPAST in SQL Server?

What is the difference between NOLOCK and READPAST in SQL Server?


Asked January 30, 2017
Posted Under: SQL Server
412 views
1 Answers

Let's look at the results of these 2 hypothetical sql statements:

Select COUNT(*) FROM Sales WITH(NOLOCK)
Results
12 records found

Select COUNT(*) FROM Sales WITH(READPAST)
Results
11 records found

They both do not create locks in the table, however, the second sql statement bypasses records with locks, so you skip that record. That could alter the results returned.


Answered January 30, 2017
Your Answer