T-SQL Tutorial

Rowversion - TSQL Tutorial


On Transact SQL language the rowversion is a data type that generate automatically unique binary numbers within a database. The storage size is 8 bytes.

Rowversion syntax:

rowversion

Rowversion example:

USE model;
GO
CREATE TABLE myTest (
id int PRIMARY KEY,
name char(20),
test_column rowversion
);
GO
INSERT INTO myTest (id, name) VALUES (1, 'test_1');
GO
INSERT INTO myTest (id, name) VALUES (2, 'test_2');
GO
SELECT * FROM myTest;
GO

idnametest_column
1test_10x0000000000000FA1
2test_20x0000000000000FA2