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:
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!!