插入数据时候,引用了数据库名,数据库名中有横线,会提示错误:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right sy ntax to use near '-all.db1(operationuser,operationtime,notes,ebay_id,types)
解决办法:
把数据库名、表名都用倒引号 引起来就可以了。
比如:
insert into `db1`.`tbl1`(operationuser,operationtime,notes,ebay_id,types)(select operationuser,operationtime,notes,ebay_id,types from `db2`.`tbl2` where `operationtime` >1367337600 order by id asc);
本文介绍了解决在MySQL中使用含有横线的数据库名时出现的语法错误的方法。当数据库名包含横线时,通过使用倒引号将数据库名括起来可以避免语法错误。

3439

被折叠的 条评论
为什么被折叠?



