0

Using the code below, it was susccessful in inserting data from csv files. However, it will not insert 100% of the data (row).. 1 or 2 records (row) data was missing...

Sample .. the number of row data is 20.. it will insert only 19 records. Please help in correcting this codes .. Thank you

LOAD DATA LOCAL INFILE 'c:/tmp/Excelfile.csv'
INTO TABLE tablecovdata
FIELDS TERMINATED BY ',' 
ENCLOSED BY '"'
LINES TERMINATED BY '\n';
IGNORE 0 ROWS;
Strawberry
  • 33,750
  • 13
  • 40
  • 57
  • Is the last line Terminated by `\n` ? – Cyborg May 09 '20 at 04:38
  • Yes, it was terminated by \n – EdenCall May 09 '20 at 05:15
  • I cannot replicate this observation – Strawberry May 09 '20 at 07:19
  • It would be good if you can show us a sample of your CSV file. I dont understand what `IGNORE 0 ROWS` is good for. The documentation says: `The IGNORE number LINES option can be used to ignore lines at the start of the file. For example, you can use IGNORE 1 LINES to skip an initial header line containing column names ` Try remove this line, more info here: https://dev.mysql.com/doc/refman/8.0/en/load-data.html AND also try: `LINES TERMINATED BY '\r\n' ` instead of: `LINES TERMINATED BY '\n' ` – Cyborg May 09 '20 at 11:35

0 Answers0