想使用load data infile方法將檔案中的資料匯入mysql的表中:
陳述句如下:
load data local infile 'E:/TmpFile.txt' replace into table Test4 character set utf8 fields terminated by ',' escaped by '\\' lines terminated by '\r\n'
陳述句用Mysql的console執行沒有問題,但是用mysql的execute方法,就會出現錯誤提示為:
(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 \'\'\' at line 1")
如果陳述句中去掉 escaped by '\\',提示ERROR 1148 (42000): The used command is not allowed with this MySQL version
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/117980.html
上一篇:希望大神幫我修改段代碼,萬分感謝
下一篇:求大神告知!
