Let's assume the following case.
There is a students table:
id | name ----------------- 1 | Mateus
A "User A" executes the following statement without committing the transaction:
update students set name = 'Gustavo' where id = 1
Then a "User B" executes the following query:
select * from students with (nolock) where id = 1
User B will get the name Gustavo, that's the expected behavior. The DB will return the uncommitted value because of the with(nolock) instruction.
Is there a way to get the old name, Mateus (the previously committed value), even when there's an uncommitted transaction?
with (nolock)in yourselect? It sounds from the text hat you do but the actual query does not... – Justin Cave May 14 '19 at 19:20SNAPSHOTorREAD COMMITTED SNAPSHOTisolation levels where a read is not blocked by a prior uncompleted transaction. – John Eisbrener May 14 '19 at 19:22