I have a csv file that looks like this
I using the following sql statement to place this into a table.
The problem I'm having is that field1 is a autoincremented field thus the load does not work. However if I add a comma before the field2 in the csv file such as below it works fine.
The problem with this is that the file is not generated this way and since there is lots of records and not computer lit person performing the task, adding the leading comma is not a feasable solution.
I have tried changing the load statement to the below, but still did not work.
Any help would be greatly appreciated.
Code:
field2,field3,field4,field5
I using the following sql statement to place this into a table.
Code:
LOAD DATA LOCAL INFILE \'$df\' INTO TABLE $table FIELDS TERMINATED BY \',\' ENCLOSED BY \'\"\' ESCAPED BY \'\\\\' LINES TERMINATED BY \'\\r\\n\'
The problem I'm having is that field1 is a autoincremented field thus the load does not work. However if I add a comma before the field2 in the csv file such as below it works fine.
Code:
,field2,field3,field4,field5
The problem with this is that the file is not generated this way and since there is lots of records and not computer lit person performing the task, adding the leading comma is not a feasable solution.
I have tried changing the load statement to the below, but still did not work.
Code:
LOAD DATA LOCAL INFILE \'$df\' INTO TABLE $table ('field2','field3','field4', 'field5') FIELDS TERMINATED BY \',\' ENCLOSED BY \'\"\' ESCAPED BY \'\\\\' LINES TERMINATED BY \'\\r\\n\'
Any help would be greatly appreciated.