web123456

Set IDENTITY_INSERT on and off

When qlserver batch insertion records, set the set IDENTITY_INSERT table name on for fields with an identified column, and then perform the insertion record operation; after insertion, restore to off settings

Format:
set IDENTITY_INSERT table name on
set IDENTITY_INSERT table name off


Example:

set IDENTITY_INSERT peoplePworkpositiontype  on
insert peoplePworkpositiontype(id,workpositiontype,workpositiontypeid) values(1, 'platform', 1)
insert peoplePworkpositiontype(id,workpositiontype,workpositiontypeid) values(2, 'land', 2)
insert peoplePworkpositiontype(id,workpositiontype,workpositiontypeid) values(3, 'On the Sea', 3)

go
set IDENTITY_INSERT peoplePworkpositiontype  off


set IDENTITY_INSERT peoplePstatetype  on
insert peoplePstatetype(id,nowstatetype,nowstatetypeid) values(1, 'going to sea', 1)
insert peoplePstatetype(id,nowstatetype,nowstatetypeid) values(2, 'business trip', 2)
insert peoplePstatetype(id,nowstatetype,nowstatetypeid) values(3, 'company', 3)
insert peoplePstatetype(id,nowstatetype,nowstatetypeid) values(4, 'conference', 4)
go
set IDENTITY_INSERT peoplePstatetype  off
go