我正在尝试执行此查询但遗憾的是我收到错误,有人能说出为什么会出现此错误,我出错了吗
我的查询:
LOAD DATA INFILE '/wamp/www/var/Book1.csv' INTO TABLE contact
FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n' IGNORE 1 LINES
(
@dummy , @dummy , column1, @dummy , column3, column2, @dummy , @dummy , @dummy , @dummy , @dummy , @dummy , column4, @dummy , @dummy , @dummy , @dummy , @dummy , @dummy , @dummy , @dummy , @dummy , @dummy , @dummy , @dummy , @dummy , @dummy , @dummy , @dummy , @dummy , @dummy , @dummy , @dummy , @dummy , @dummy
) ;
错误:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'
IGNORE 1 LINES' at line 4
答案 0 :(得分:1)
您必须更改fields...
和列名称的顺序:
LOAD DATA INFILE '/wamp/www/var/Book1.csv' INTO TABLE contact
FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n' IGNORE 1 LINES
(
@dummy , @dummy , name, @dummy , nationality, mobile1, @dummy , @dummy , @dummy , @dummy , @dummy , @dummy , twon, @dummy , @dummy , @dummy , @dummy , @dummy , @dummy , @dummy , @dummy , @dummy , @dummy , @dummy , @dummy , @dummy , @dummy , @dummy , @dummy , @dummy , @dummy , @dummy , @dummy , @dummy , @dummy
) ;