No. While LOAD DATA INFILE has a REPLACE option, it will actually replace the row in question - that is, delete the existing one and insert a new one.
Up vote 4 down vote favorite 2 share g+ share fb share tw.
Pseudo table: | primary_key | first_name | last_name | date_of_birth | | 1 | John Smith | | 07/04/1982 | At the moment *first_name* contains a users full name for many rows. The desired outcome is to split the data, so first_name contains "John" and last_name contains "Smith". I have a CSV file which contains the desired format of data: | primary_key | first_name | last_name | | 1 | John | Smith | Is there a way of using the LOAD DATA INFILE command to process the CSV file to UPDATE all rows in this table using the primary_key - and not replace any other data in the row during the process (i.e.
Date_of_birth)? Mysql load-data-infile link|improve this question edited Dec 27 '09 at 3:08OMG Ponies95.1k1065138 asked Oct 1 '09 at 21:10cw84391322 93% accept rate.
No. While LOAD DATA INFILE has a REPLACE option, it will actually replace the row in question - that is, delete the existing one and insert a new one. If you configure your LOAD DATA INFILE to only insert certain columns all others will be set to their default values, not to values they currently contain.
Can you modify your CSV file to contain a bunch of UPDATE statements instead? Should be reasonably straightforward via some regex replaces.
In this situation I usually LOAD DATA INFILE to a temp table with identical structure. Then I do INSERT with ON DUPLICATE KEY UPDATE from the temp table to the real table. This allows for data type checking without wrecking your real table; it's relatively quick and it doesn't require fiddling with your .
Csv file.
There is a nice tutorial in PHP about that. Adapt accordingly to your needs.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.