2010-11-16 70 views
0

查询:load data infile 'systemmessage.txt' ignore into table systemmessage (message) lines starting by 'a,' terminated by '\0' ignore 1 lines加载数据INFILE语法错误

给我一个语法错误附近'行开始'。 如果我删除'开始'部分,现在错误与'终止'。如果我也删除它,错误是'忽略1行'。 地狱是什么问题?该文件存在,该表存在,如果我删除它加载的所有检查,但是有错误的数据。

+0

准备再次你systemmessage.txt要严格遵循MySQL的规范 - http://dev.mysql.com/doc/refman/5.1/en/load-data.html – ajreal 2010-11-16 17:56:33

+0

OMG的问题不是出在systemmessage 。文本!这是一个SQL语法错误!我准备好用这个令人难以置信的愚蠢问题来解决问题,并且你建议我在过去的几个小时内读过几百次的东西!无论如何,我终于设法通过这个,但比过去一周浪费更多的神经... – jurchiks 2010-11-16 18:12:42

+0

你应该只是愚蠢的证明你的systemmessage.txt是100%符合mysql规范,你尝试只插入一行(单记录),以确保至少它将工作1线? – ajreal 2010-11-16 18:43:54

回答

1

您只需将列列表移动到SQL语句的末尾即可。

由于手册中描述的那样,格式信息(行开始通过,跳过1行,等等)需要(可选的)列列表之前被指定:

http://dev.mysql.com/doc/refman/5.1/en/load-data.html

这里的固定查询:

load data infile '/tmp/systemmessage.txt' 
ignore into table systemmessage 
lines starting by 'a,' 
terminated by '\0' 
ignore 1 lines 
(message)