Reputation: 13
Here is the SQL query I have so far:
LOAD DATA INFILE 'filename.csv'
INTO TABLE zt_accubid
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\r\n'
IGNORE 4 LINES
I need to be able to end the process once a field with value="xyz"
is encountered.
Is this possible?
Upvotes: 1
Views: 135
Reputation: 65334
LOAD DATA INFILE
has no such option. There are a couple of workaraounds, though
LOAD DATA
inside a transcation, you can use a unique key as a stopper.LOAD DATA
into an interims table, then use INSERT INTO ... SELECT
to move only the relevant data into your final tableUpvotes: 1
Reputation: 16362
Sure - put a row in the database before the load, and put a unique key on it. The LOAD should fail when it hits the duplicate.
Upvotes: 0