chemicaluser — 2012-09-17T19:23:43-04:00 — #1
I have a csv file which I am using to populate my table ... the file looks like this
This is the data, I will ignore this line when inserting
john, smith, 25
mike, jones, 19
kelly, smith, 22
This line I don't want to add
I use the following to load my data ...
LOAD DATA INFILE 'myfile.csv'
INTO TABLE mytable
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\\r\
IGNORE 1 LINES;
All works good, but is there any way to IGNORE the LAST LINE 'This line I don't want to add' ????
r937 — 2012-09-17T22:28:03-04:00 — #2
nope, not without editing the file in some way, and if you're going to do that, then you might as well just remove that line yourself
cpradio — 2012-09-18T06:21:58-04:00 — #3
I don't know of a way either, but if you have an ID column that is auto incremented, you can always delete the last row in the table (this is all in theory, no idea if it would actually work)
DELETE FROM mytable WHERE ID = MAX(ID)
mittineague — 2014-09-18T22:42:58-04:00 — #4
This topic is now archived. It is frozen and cannot be changed in any way.