Quantcast
Channel: Recent Edits
Viewing all articles
Browse latest Browse all 12198

Strange example

$
0
0
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(

Viewing all articles
Browse latest Browse all 12198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>