gpt4 book ai didi

mysql错误 "unrecognized statement type. (near terminated by)"

转载 作者:行者123 更新时间:2023-11-29 16:35:40 24 4
gpt4 key购买 nike

我的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

我检查过,语法是正确的。我不明白出了什么问题?谢谢

最佳答案

如果您阅读the documentation very closely您可以看到,虽然 FIELDS 是可选的,但如果您 promise 使用该选项,则必须包含该部分:

LOAD DATA INFILE 'C:\projects\v1.csv' INTO TABLE ups
FIELDS 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);

如果没有这一点,FIELDSLINES 所终止的内容就会含糊不清,因为两者都有一个 TERMINATED BY 组件。

具体来说,{FIELDS | COLUMNS} 表示法表示其中之一,不是可选的。

关于mysql错误 "unrecognized statement type. (near terminated by)",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53614052/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com