MySQL Forums
Forum List  »  General

Re: loading data problem
Posted by: Rick James
Date: March 20, 2012 10:42AM

Most LOAD DATA problems can/should be addressed _after_ loading.

A common pattern is to LOAD into an extra table, then perform transforms while moving the data into the real table. (Then DROP or TRUNCATE-and-reuse the extra table.)

In your case, have an AUTO_INCREMENT in the extra table, do no include that column in the LOAD statement. Then, when moving to the real table, do
INSERT INTO real_table (...)
SELECT ... FROM extra_table WHERE id != 7952;

The two "..." could
* avoid the id column (in your case) or other unwanted columns,
* allow for rearranging the columns,
* have expressions,
* convert datatypes,
* etc.

Options: ReplyQuote


Subject
Written By
Posted
March 19, 2012 03:22PM
Re: loading data problem
March 20, 2012 10:42AM
March 20, 2012 12:48PM
March 28, 2012 11:50PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.