简体   繁体   中英

MySQL load data infile error with enclosed

I am trying to create a MySQL to load data from csv to table.

load data infile 'C:/ProgramData/MySQL/MySQL Server 8.0/Uploads/data.csv'
into table tb_booking
ENCLOSED BY '"' IGNORE 1 ROWS
(id,booking_no,mso_id,po_id,po_ref_no,marks_and_no,goods_desc);

But I am encountering error saying ( ENCLOSED is not a valid input at this position ). What am I doing wrong?

As error states, your position of Enclosed by is not correct. Your command should be like below.

load data infile 'C:/ProgramData/MySQL/MySQL Server 8.0/Uploads/data.csv'   into table tb_booking(id,booking_no,mso_id,po_id,po_ref_no,marks_and_no,goods_desc)  FIELDS TERMINATED BY ',' ENCLOSED BY '"' IGNORE 1 ROWS;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM