You'd never compare the RowVersion field with another field in the table. You have to compare it to a previously obtained value:-- Simulate two users fetching data from the same row:DECLARE @CurrentRV1 rowversionDECLARE @CurrentRV2 rowversionSELECT @CurrentRV1 = RV, @CurrentRV2 = RVFROM MyTest WHERE myKey = 1-- The first user updates the rowDECLARE @t TABLE (myKey int);UPDATE MyTestSET myValue = 42 OUTPUT inserted.myKey INTO @t(myKey) WHERE myKey = 1 AND RV = @CurrentRV1;IF (SELECT COUNT(
↧