mysql 數據庫名稱,中間帶有中划線問題


插入數據時候,引用了數據庫名,數據庫名中有橫線,會提示錯誤:

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);


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM