1.在创建表的时候就设置标识列
CREATE TABLE [dbo].[Table1](
[column1] [int] IDENTITY(1,1) primary key,
[column2] [varchar](30) NOT NULL,
[column3] [datetime] NULL
)
[column1] [int] IDENTITY(1,1) primary key,
[column2] [varchar](30) NOT NULL,
[column3] [datetime] NULL
)
2.插表时打开标识插入与关闭标识输入
Set IDENTITY_INSERT DB.dbo.Table1 ON
Set IDENTITY_INSERT DB.dbo.Table1 OFF