If you make the client application generate the IDs you can use a straight-forward SqlBulkCopy
to insert all rows at once. It will be done in seconds.
If you want to keep the IDENTITY
property of the column, you can run a DBCC CHECKIDENT(RESEED)
to advance the identity counter by 1.5m to give you a guaranteed gap that you can insert into. If the number of rows is not statically known you can perform the inserting in smaller chunks of maybe 100k until you are done.