SQL Server Performance

Question about RowVersion Data Type

Discussion in 'General Developer Questions' started by wkm1925, Dec 13, 2009.

  1. wkm1925 New Member

    From my SQL statement,
    declare @tEmployee table
    (
    TrnxID int primary key identity(1,1),
    Nme varchar(100),
    RowID rowversion
    )
    insert into @tEmployee(Nme) values('Mike Tyson')
    insert into @tEmployee(Nme) values('Hollyfield')

    SQL 1 - select * from @tEmployee
    the result as follow,
    1 Mike Tyson 0x00000000000007FA
    2 Hollyfield 0x00000000000007FB

    SQL 2 - select TrnxID,Nme,cast(RowID as BigInt) from @tEmployee
    the result as follow,
    1 Mike Tyson 2042
    2 Hollyfield 2043

    I convert RowVersion to BigInt because i want to make it front-end (ASP.NET) can read it easily.
    Did a SQL 1 and SQL 2 same?
  2. Adriaan New Member

    You can store the 0x00000000000007FA bit from the first query in a string type variable, if you must store it. Do you want to use this to double-check that the row has not been updated since you read the data?

Share This Page