table: Department
column: DeptID(自增长)
插入列:Insert into Department(DeptID,Name,Status) values(0,'Other',0)
当第三方程序执行sql时报错(数据库直接执行是成功的,默认会有IDENTITY_INSERT的开启关闭)
Create DB failed.
Cannot insert explicit value for identiry column in table 'Department' when IDENTITY_INSERT is set to OFF.
原因:需要开启对标识列显示值插入模式
SET IDENTITY_INSERT [dbo].[Department] ON
Insert into Department(DeptID,Name,Status) values(0,'Other',0)
SET IDENTITY_INSERT [dbo].[Department] OFF
插入数据后需要关闭对标识列显示值的插入操作