views:

46

answers:

1

I use LOAD DATA LOCAL INFILE to upload csv files to MySQL.

If the csv was created by a mac, I include LINES TERMINATED BY '\r' in the query. If the csv was created by a MS Office, I include LINES TERMINATED BY '\n' in the query. If the csv was created in Open Office, I omit LINES TERMINATED BY altogether.

Is there a way I can formulate my query so the csv will be uploaded regardless of how it was created?

A: 

Look up line-termination stripping procs. There should be a few resources out there which look at \r\n issues and how to fix them in different coding sets.

glasnt