开发者

Mysql - Troublesome replace

I'm trying to remove all occurences of ` in TRIGGER_NAME and replace them with '

UPDATE Scheduler.dbo.QRTZ_BLOB_TRIGGERS
SET TRIGGER_NAME =开发者_如何学Python REPLACE(TRIGGER_NAME, '`', '\\'')
WHERE
TRIGGER_NAME LIKE '%`%';

The logic I'm following is that I need to escape \' to show it but also save it escaped?

http://dev.mysql.com/doc/refman/5.5/en/string-syntax.html


You usually only need a single backslash, ie

REPLACE(TRIGGER_NAME, '`', '\'')

You can also use a double single-quote which is more standard across database vendors

REPLACE(TRIGGER_NAME, '`', '''')
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜