1

We have SQL server 2017, and we want to create a new field inside existing database

  • the field data type is RowVersion
  • but using the SQL Management Studio I can not define a field with RowVersion data type
  • we can use Timestamps
  • but per my knowledge TimeStamp are now deprecated in favor of RowVersion

Any advice on this?

Here is the DataType list which does not contain rowversion:

enter image description here

EDIT

Now i wrote the following script to create a new table with rowversion column type:-

SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[test2](
    [id] [int] NOT NULL,
    [rowversion] [rowversion] NOT NULL,
 CONSTRAINT [PK_test2] PRIMARY KEY CLUSTERED 
(
    [id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO

but when i open the table inside the SQL management studio GUI >> the type for the new column inside the new table will be timestamp instead of rowversion + if i generate a Create to script for the new table i will get this:-

USE [test]
GO

/****** Object:  Table [dbo].[test2]    Script Date: 26/08/2021 19:02:56 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[test2](
    [id] [int] NOT NULL,
    [rowversion] [timestamp] NOT NULL,
 CONSTRAINT [PK_test2] PRIMARY KEY CLUSTERED 
(
    [id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO

so seems rowversion can be used to create the table but it will be converted to timestamp... the issue is that Microsoft say that timestamp is deprecated and that we should use rowversion instead... totally confusing!!

John John
  • 1
  • 72
  • 238
  • 501

1 Answers1

1

This was an error in the microsoft documentation. I submitted a pull request to have that corrected, and that PR has been accepted.

The problem, and the thing confusing you here, was that the documentation claimed that "timestamp" was a synonym for "rowversion". But in fact the opposite is true. "Rowversion" is the synonym, "timestamp" is the base type name.

Both names actually refer to the same thing under the covers, but different tools have differing levels of support for synonyms. The graphical designers are old and have not been updated in a very, very long time.

allmhuran
  • 4,154
  • 1
  • 8
  • 27