Hi-- I have a set of tables where each table's ID key is auto_incrementing. Now my users want to import a bunch of external data that has different keys from a single csv flat file.
I think the best way to do it is to lock the tables, grab the next value for the auto_increment column for each table, then for each row I insert just swap out the existing primary key for the new AI value. This is going to get really ugly since the data to import has multiple tables and multiple key relationships.
Any other ideas on how to handle a problem like this? Stored procedure maybe? Thanks for any ideas.