为什么MySQL拒绝INSERT INTO中字符串中的管道('|')字符

Man*_*eau 8 mysql sql

如果我试试这句话:

INSERT INTO TerminalEventChild (id,stringValue) VALUES 
(64,'version123|');
Run Code Online (Sandbox Code Playgroud)

MySQL失败了:

Error: 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 ''version123' at line 1
SQLState:  42000
ErrorCode: 1064
Run Code Online (Sandbox Code Playgroud)

如果我删除| 一切都很好.任何的想法?

小智 18

我在不正确的查询解析上找到了解决方案- ID:3091322.
Squirrel SQL使用管道符号作为过程/函数分隔符,因此您需要更改MySQL首选项以使用其他内容(例如|||).

在"文件>全局首选项> MySQL"选项卡的"过程/功能分隔符"字段中,替换| 使用不同的字符串,例如||| .


Qua*_*noi 3

在我的机器上,这工作正常:

CREATE TABLE TerminalEventChild (id INT, stringValue VARCHAR(200));

INSERT INTO TerminalEventChild (id,stringValue) VALUES
(64,'version123|');
Run Code Online (Sandbox Code Playgroud)

也许,您的客户特别对待管道字符。

你用什么客户端?