According to the rowversion docs
Each database has a counter that is incremented for each insert or update operation that is performed on a table that contains a rowversion column within the database.
however this 'increment' skips an integer when looping back from FF to 01. e.g.
0x00000000000007FF
0x0000000000000801
To reproduce, create a table
CREATE TABLE [dbo].[TestTable](
[Id] [bigint] IDENTITY(1,1) NOT NULL,
[SomeData] [varchar](200) NOT NULL,
[RowVersion] [rowversion] not null
) ON [PRIMARY]
Now add some inserts:
DECLARE @i INT = 0
WHILE @i < 256
BEGIN
SET @i = @i + 1
INSERT INTO [TestTable] ([SomeData]) VALUES (CONVERT(VARCHAR(255), NEWID()))
END
view the data:
select * from [TestTable] order by [RowVersion] asc
Data will vary depending on whether you have used rowversion
We see in this case 2047 (0x00000000000007FF) jumps to 2049 (0x0000000000000801)
Why is this?

The referenced documentation mentions the rowversion value is unique, binary, and incrementing. It doesn't say there won't be gaps. The value is intended to be used for optimistic concurrency validation so gaps should not matter for that purpose.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With