SQL Interview: 60 Rowversion vs Timestamp

SQL Interview: 60 Rowversion vs Timestamp

This is a post in the SQL Interview series. These aren’t trick or gotcha questions, they’re just questions designed to scope out a candidate’s knowledge around SQL Server and Azure SQL Database.

Section: Development Level: Medium

Question:

You are reviewing T-SQL code from an application.

You notice in the definition of some tables, the timestamp data type has been used. In other tables, the rowversion data type has been used for similar purposes.

What difference (if any) is there between these two data types? Which should you use for new development work? Can either be converted to a datetime value?

Answer:

In SQL Server 2005, the timestamp data type was replaced by the rowversion data type. The timestamp data type had an unfortunate name, and is completely unrelated to a date or time value, so you cannot convert it to one. It is essentially a binary serial number for a version of a row.

The timestamp data type is deprecated and should not be used for new work. rowversion is a synonym for timestamp, and should be the type that is used when doing new development.

The only difference between the data types has been in support at the client driver level. Some drivers treated rowversion as a timestamp data type. Updated drivers do not do this.

2025-07-03