Rowversion/timestamp in SSMS 2018 version

Maneesha John 21 Reputation points
2022-10-18T13:04:09.533+00:00

I need to create a column with rowversion as column name and the datatype is either rowversion or timestamp. I am getting an error saying that 'cannot find the datatype 'timestamp' and 'cannot find the datatype rowversion'. I am copying a table from external database. So it will be good for me to keep the column name as rowversion itself. Help me here to create a column in the table.
This is the syntax I have used.

alter table table_name
add rv rowversion

alter table table_name
add rv timestamp

251633-image.png 251607-image.png

Azure SQL Database
Azure Synapse Analytics
Azure Synapse Analytics
An Azure analytics service that brings together data integration, enterprise data warehousing, and big data analytics. Previously known as Azure SQL Data Warehouse.
{count} votes

Answer accepted by question author
  1. Dan Guzman 9,411 Reputation points
    2022-10-20T09:20:44.003+00:00

    I have one doubt though. I am trying to do this in Azure Synapse. Is that the problem?

    Yes. Azure Synapse supports most T-SQL types but there are a few exceptions. Below is an excerpt from the Query Language documentation that explains why the rowversion (a.k.a. timestamp) is not recognized (added emphasis in bold):

    all Transact-SQL types except cursor, hierarchyid, ntext, text, and image, rowversion, Spatial Types, sql_variant, and xml

    You can use timestamp as a column name but with an alternate data type (e.g. binary(8)). The implication is data loaded as part of an ETL process will need to be converted for ingestion and. of course, the value will not automatically change with row updates like rowversion type values do in SQL Server.


2 additional answers

Sort by: Most helpful
  1. Michael Taylor 61,106 Reputation points
    2022-10-18T15:05:18.337+00:00

    timestamp is deprecated and should not be used. It is an alias for rowversion.

    The syntax looks valid at this point.

       ALTER TABLE TestTable  
       ADD rv rowversion;  
    

  2. GeethaThatipatri-MSFT 29,587 Reputation points Microsoft Employee Moderator
    2022-10-18T16:23:46.963+00:00

    @Maneesha John I tried SSMS 18.12.1 with SQL Server 2019 and works for me
    251711-image.png

    Regards
    Geetha


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.