开发者

Mysql - Troublesome replace

开发者 https://www.devze.com 2023-03-29 02:32 出处:网络
I\'m trying to remove all occurences of ` in TRIGGER_NAME and replace them with \' UPDATE Scheduler.dbo.QRTZ_BLOB_TRIGGERS

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

精彩评论

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