我有mysql版本5.7.19,我正在尝试运行:
load data infile 'C:\projects\v1.csv' into table ups terminated by ',' lines terminated by '\n' (company,ups_name,ups_ip,ups_mac,community,type_id,mdm_mac,ter_dir,td,cty,city,location,address,is_active,connected_device_name,connected_device_type,on_id,optical_node,inserted,updated);
但是得到一个错误:
unrecognized statement type. (near terminated by)
# 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 'terminated by ','
lines terminated by '\n' (company,ups_name,ups_ip,ups_mac,comm' at line 1
我检查了一下语法是否正确。我搞不懂怎么了?谢谢
1条答案
按热度按时间tsm1rwdh1#
如果您仔细阅读文档,您可以在
FIELDS
是可选的,如果您承诺使用该选项,则必须包括该部分:如果没有这一点,就不清楚什么是被终止的,
FIELDS
或者LINES
,因为两者都有TERMINATED BY
组件。具体来说
{FIELDS | COLUMNS}
符号表示其中之一,不是可选的。