从CSV文件加载数据本地infile,其中字段未包含在内

时间:2016-11-24 15:14:56

标签: mysql csv

尝试使用load data local infile将数据从csv文件导入mysql表:

LOAD DATA LOCAL INFILE 'wentronic.csv' INTO TABLE wentronic1 fields OPTIONALLY ENCLOSED BY \"\" ignore 1 lines

来自csv的一行:

29995;LED Driver 10-24 V (DC)/12-20 W - dimmable, 3 output voltages, 3 output currents;96869;LED Driver 10-24 V (DC)/12-20 W<br>dimmable, 3 output voltages, 3 output currents;4040849299957;01;23,66;00;0;00;0;00;0;00;0;350;1;Goobay;36;85043180900;;Goobay LED Driver 10-24 V (DC)/12-20 W, Plastic bag - dimmable, 3 output voltages, 3 output currents<br>DC current source for LEDs with electronic ballast unit<br>output voltage adjustable: 10 V/12 W, 12 V/14 W, 24 V/20 W<br>Output current adjustable: 350mA, 700mA, 1000mA<br>secured in four ways: short circuit, overheat, overload, idling<br>approved for installation in furniture<br>safe electronic separation as per protection class II;CN;0;;4,5;2;43,99;;Length;110;mm;Number of outputs;2;pieces;Output, max. amperage;1000;mA;Dimmability;dimmable;;max. performance;20;W;Width;52;mm;Height;24;mm;Output, voltage;24;V (DC);Input, Voltage Range;220 - 240 (AC);V;Appliance Class;II;;;;;;;;;;;;;;;;;1;4040849299957;0;0;0;0;0;0;0;0

问题是没有字段有引号,只导入表中整数的字段。正如你所看到的,我试图通过说明字段可选地被......封闭来“欺骗”mysql: - )

有任何帮助吗? : - )

1 个答案:

答案 0 :(得分:1)

这个怎么样?

LOAD DATA LOCAL INFILE '/path/to/wentronic.csv' INTO TABLE wentronic1 FIELDS TERMINATED BY ';' IGNORE 1 LINES;

看起来您的字段以分号结尾,如果这是真的,您不关心字段是否被任何内容封装。