how can a row version be less than a previous one in a later insert in a later batch

db042190 1,516 Reputation points
2020-09-22T21:19:50.85+00:00

Hi we run 2014 developer where this occurred.

i'm looking at evidence that a row version in my most recent set of inserts has a lower value than that of an insert from a previous batch. i thought that was impossible.

arent row versions always supposed to be increasing? is it possible someone ran something that reset them?

Azure SQL Database
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,759 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,555 questions
0 comments No comments
{count} votes

Accepted answer
  1. m 4,271 Reputation points
    2020-09-23T06:46:17.867+00:00

    Hi @db042190 ,

    arent row versions always supposed to be increasing?

    Yes.The rowversion data type is an incrementing number.
    And you should note this : Duplicate rowversion values can be generated by using the SELECT INTO statement in which a rowversion column is in the SELECT list. We do not recommend using rowversion in this manner.

    is it possible someone ran something that reset them?

    No. It is not possible to reset them. Because they are generated automatically by rowversion counter.

    Quote from rowversion-transact-sql
    It is a data type that exposes automatically generated, unique binary numbers within a database. rowversion is generally used as a mechanism for version-stamping table rows. The storage size is 8 bytes. The rowversion data type is just an incrementing number and does not preserve a date or a time.

    BR,
    Mia


    If the answer is helpful, please click "Accept Answer" and upvote it.

    0 comments No comments

10 additional answers

Sort by: Most helpful
  1. db042190 1,516 Reputation points
    2020-09-23T11:07:09.6+00:00

    my apologies, while collecting the evidence pituach requested i see that i jumped to the wrong conclusion. small image uploads are once again freezing in this new forum so i'll try to show the images in a separate answer.

    0 comments No comments

  2. db042190 1,516 Reputation points
    2020-09-23T11:10:26.347+00:00

    27061-thecreate.png

    27071-procsnippet.png

    27081-results.png

    0 comments No comments

  3. db042190 1,516 Reputation points
    2020-09-23T11:12:42.327+00:00

    finally, the history of this was a maint run with audit key 16 followed by one with audit key 38 followed by one with audit key negative six. i think my mistake was not looking at the update audit key when i jumped to the wrong conclusion. the last 2 selects of the 3rd image above returned nothing.

    0 comments No comments

  4. Tom Phillips 17,716 Reputation points
    2020-09-23T12:12:00.76+00:00

    You are operating under the wrong assumption.

    Row version is a ROW version. It is not "table" version. Row version changes at the row level. It only indicates the row changed, not the table.

    0 comments No comments