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, '`', '''')
精彩评论