utstrangelove
01-03-2012, 07:24 PM
Hi all and happy new year...hope you can help with my csv issue.
I'm trying to load some data into my db using a csv file, everything is fine until it come across a string that has "quotation marks" around it and messes up the table row.
Any ideas how to escape it?
Example CSV Data
"1","Joe","Bloggs",""16 AppleTree Drive""
Code used for importing data
LOAD DATA LOCAL INFILE '$csv' REPLACE INTO TABLE loader fields terminated by ',' enclosed by '\"' lines terminated by '\r\n' IGNORE 1 LINES ($col_names)
Thanks for your help
I'm trying to load some data into my db using a csv file, everything is fine until it come across a string that has "quotation marks" around it and messes up the table row.
Any ideas how to escape it?
Example CSV Data
"1","Joe","Bloggs",""16 AppleTree Drive""
Code used for importing data
LOAD DATA LOCAL INFILE '$csv' REPLACE INTO TABLE loader fields terminated by ',' enclosed by '\"' lines terminated by '\r\n' IGNORE 1 LINES ($col_names)
Thanks for your help