自增ID时如何插入ID
自增ID时如何插入ID
SET IDENTITY_INSERT TABLE_NAME ON;
INSERT INTO TABLE_NAME(XXX, XXX,..., XXX) SELECT XXX, XXX,..., XXX FROM TABLE_NAME_BAK;
注意: 即使是所有列,这里的字段名也不能省略.
SET IDENTITY_INSERT TABLE_NAME OFF;
自增ID时如何插入ID
SET IDENTITY_INSERT TABLE_NAME ON;
INSERT INTO TABLE_NAME(XXX, XXX,..., XXX) SELECT XXX, XXX,..., XXX FROM TABLE_NAME_BAK;
注意: 即使是所有列,这里的字段名也不能省略.
SET IDENTITY_INSERT TABLE_NAME OFF;