Code: Select all
drop table if exists test;
create table test (col1 VARCHAR(64), col2 VARCHAR(80) );
LOAD DATA LOCAL INFILE "t.csv" INTO TABLE test FIELDS OPTIONALLY ENCLOSED BY '"' ESCAPED BY '"' COLUMNS TERMINATED BY ';' LINES TERMINATED BY '\r\n' ;
< /code>
Die Daten sind Folgendes: < /p>
E507;^M"A string^M
spanning several lines "some Umlauts in "üöä" to show"^M
escaping^M
last line"^M
E600;"once^M
again"^M
< /code>
Der Fehler tritt auf, wenn ich die zugeordneten Schlüsselwörter der Felder hinzufüge:
FIELDS OPTIONALLY ENCLOSED BY '"' ESCAPED BY '"'
Absicht dahinter ist, dass Varchars entweder ohne '"' und Varchars in '"' gerahmt sind. Aber die äußeren Framing '"sollte nicht in den Daten erscheinen.