开发者

Why does MySQL refuse pipe ('|') character in string on INSERT INTO

If I try this statement:

INSERT INTO TerminalEventChild (id,stringValue) VALUES 
(64,'version123|');

MySQL fail with :

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

If I remove the | char开发者_如何学Pythonacter, everything works fine. Any idea?


I found the solution on Incorrect query parsing - ID: 3091322.
Squirrel SQL is using the pipe symbol as a procedure/function separator, so you need to change the MySQL preferences to use something else (e.g. |||).

In the "File > Global Preferences > MySQL" tab, in the "Procedure/Function Separator" field, replace | with a different string, for example |||.


On my machine, this works fine:

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

INSERT INTO TerminalEventChild (id,stringValue) VALUES
(64,'version123|');

Probably, your client treats the pipe character specially.

What client do you use?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜