我怎样才能改变cloumn的incerement值

时间:2015-10-19 09:55:02

标签: sql-server-2012

我有一张桌子并且有很多记录,我无法删除并重新创建它 我需要将Id列的增量值更改为2,旧值为1

这是我需要更改

的标识增量的表的示例
CREATE TABLE [dbo].[RELATED](
[Id] [int] IDENTITY(1,1) NOT NULL,
[RELATEDDESC] [nvarchar](50) NOT NULL,
[USER_ID] [int] NULL,
[ALTER_DATE] [datetime2](7) NULL,
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

1 个答案:

答案 0 :(得分:0)

要指定“ID”列应从值1开始并以2递增,请将其更改为IDENTITY(1,2)。

编辑*

ALTER TABLE [dbo].[RELATED] 
ALTER COLUMN [Id] [int] IDENTITY(1,2) NOT NULL