MySQL Forums
Forum List  »  General

loading CSV into mysql (innodb engine)
Posted by: Syed Shah
Date: August 22, 2014 03:09PM

Hi,

I have a CSV file that has data in below format

DeptIncidentID,Description
14-8717-AR ,"TRO - TURNING, FAIL TO USE CARE"
14-8717-AR ,OUI LIQUOR

My sql syntax for loading this csv file is below

LOAD DATA LOCAL INFILE 'C:\\PD Files\\test1.txt' IGNORE INTO TABLE `police_schema`.`test_csv` CHARACTER SET latin1 FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' ESCAPED BY '"' LINES TERMINATED BY '\n' IGNORE 1 LINES (`DeptIncidentID`, `Description`);

The above test csv file has two rows,However, the both rows are loaded as a single row. The second row is concatenated with the description field of first row.

Can someone please tell me how to fix this script to load the whole file

Arif

Options: ReplyQuote


Subject
Written By
Posted
loading CSV into mysql (innodb engine)
August 22, 2014 03:09PM


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.