为什么MySQL拒绝在INSERT INTO字符串中使用竖线('|')字符 [英] Why does MySQL refuse pipe ('|') character in string on INSERT INTO

查看:438
本文介绍了为什么MySQL拒绝在INSERT INTO字符串中使用竖线('|')字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我尝试使用以下语句:

If I try this statement:

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

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

如果我删除|角色,一切正常.有什么主意吗?

If I remove the | character, everything works fine. Any idea?

推荐答案

在我的计算机上,此方法工作正常:

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.

您使用什么客户端?

这篇关于为什么MySQL拒绝在INSERT INTO字符串中使用竖线('|')字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆