Mega Code Archive

 
Categories / MSSQL Tutorial / Query
 

Using a Table with a rowversion Column

3>  CREATE TABLE MyTable( 4>   DataValue int        NOT NULL, 5>   RowVer    rowversion NOT NULL 6> ) 7> GO 1> INSERT MyTable (DataValue) VALUES (1) 2> INSERT MyTable (DataValue) VALUES (2) 3> INSERT MyTable (DataValue) VALUES (3) 4> INSERT MyTable (DataValue) VALUES (4) 5> GO (1 rows affected) (1 rows affected) (1 rows affected) (1 rows affected) 1> UPDATE MyTable 2> SET 3>   DataValue = 10 4> WHERE 5>   DataValue = 3 6> GO (1 rows affected) 1> SELECT 2>   * 3> FROM 4>   MyTable 5> GO DataValue   RowVer ----------- ------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------ ----------------------------------------------           1 0x0000000000000FB0           2 0x0000000000000FB1          10 0x0000000000000FB4           4 0x0000000000000FB3 (4 rows affected) 1> 2> drop table MyTable 3> GO