MySQL Auto Increment – Inserting Missing Day of Data into Table with Incremented Primary Key

auto-incrementinsertMySQL

So I recently switched servers, but there is a day inbetween the switch of servers where the data didn't get carried over. I have exported the missing data in a CSV.

I know there is 617 rows to be inserted into the "primary" database, problem is there is entries which have already taken the "primary key" (in this case, it is called "id"). This ID auto increments by 1.

What I would like to do, is the following:

starting at id = 552611 ADD $ID + 618 & repeat till end of table. 

This would allow me to insert the 617 keys starting at:

id = 552611

Ending at:

id = 553228

My SQL-Foo is not that strong! Can anybody point me in the right direction?

Best Answer

Since you're changing the identity of the row, can we assume that it's not used as a foreign key of another table? If it's only purpose is to uniquely identify the row of the table it's on, then don't bother attempting to assign it a new identity because it's already auto incremented by one, upload your CSV without specifying the id column and it will take care of the id.

You'd have to worry about key collision and identity_insert etc, it's just a mess, but if your heart is set on it, there are ways it could be done.