set identity insert sql server code example
Example 1: identity insert on sql server
SET IDENTITY_INSERT sometableWithIdentity ON
INSERT sometableWithIdentity (IdentityColumn, col2, col3, ...)
VALUES (AnIdentityValue, col2value, col3value, ...)
SET IDENTITY_INSERT sometableWithIdentity OFF
Example 2: set identity_insert off
SET IDENTITY_INSERT [ [ database_name . ] schema_name . ] table_name { ON | OFF }