How To Create Table with Identity Column

前端 未结 4 1785
深忆病人
深忆病人 2020-11-27 17:18

I have an existing table that I am about to blow away because I did not create it with the ID column set to be the table\'s Identity column.

Using

4条回答
  •  余生分开走
    2020-11-27 17:49

    CREATE TABLE [dbo].[History](
        [ID] [int] IDENTITY(1,1) NOT NULL,
        [RequestID] [int] NOT NULL,
        [EmployeeID] [varchar](50) NOT NULL,
        [DateStamp] [datetime] NOT NULL,
     CONSTRAINT [PK_History] 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]
    

提交回复
热议问题