KEEPIDENTITY applicable only in an INSERT statement when the BULK option is used with OPENROWSET. Specifies that the identity value or values in the imported data file are to be used for the identity column. If KEEPIDENTITY is not specified, the identity values for this column are verified but not imported and the query optimizer automatically assigns unique values based on the seed and increment values specified during table creation.
Here is the Example
INSERT INTO HumanResources.myDepartment
(DepartmentID, Name, GroupName, ModifiedDate)
FROM OPENROWSET(BULK 'C:\myDepartment-n.Dat',
FORMATFILE='C:\myDepartment-f-n-x.Xml') as t1;
SQL Server Tips · · · ·