rowversion
is just an alias for timestamp
. Under the covers, they are the exact same thing.
If you're using the GUI (prior to 2012), you have to use timestamp
. (Peripheral hint: please stop using the GUI.)
But it doesn't stop there. Even if you generate this table using DDL:
CREATE TABLE dbo.x(y ROWVERSION);
The data type in the metadata will be timestamp
:
SELECT t.name
FROM sys.types AS t
INNER JOIN sys.columns AS c
ON c.system_type_id = t.system_type_id
INNER JOIN sys.tables AS st
ON c.[object_id] = st.[object_id]
INNER JOIN sys.schemas AS s
ON st.[schema_id] = s.[schema_id]
WHERE st.name = N'x'
AND s.name = N'dbo'
AND c.name = N'y';
And if you generate a script for this table, it will also include timestamp
:
CREATE TABLE [dbo].[x](
[y] [timestamp] NOT NULL
) ON [PRIMARY]
And in fact:
SELECT * FROM sys.types WHERE name = N'rowversion';
Results:
----
0 row(s) affected.
So there isn't even a type in the system named rowversion
- any DDL that includes it gets parsed and translated before the DDL is even executed against the server.
Microsoft has been a walking contradiction on this since they first introduced the poorly-named data type (which also happens to violate the SQL standard, which dictates that the timestamp
data type should be used for date/time data). I asked back in 2007 for this to be properly deprecated. My Connect item is still active (archive)- feel free to vote and, more importantly, comment about how the documentation contradicts the possible usage of the product.
Others have written about this too.
TIMESTAMP
) as column names - use something more meaningful! Then it'll work.timestamp
is not meaningful in that context. Unless you think thatrowversion
contains information about date and time, it's actually quite misleading.