我想在SQL中使用replace命令将列文本Test替换为Test。 我尝试过使用
UPDATE table
SET column = REPLACE(column, 'test's', 'test');
但是在测试中,它正在采取'作为额外报价。
答案 0 :(得分:3)
要在字符串常量中包含单引号,只需加倍:
UPDATE table
SET column = REPLACE(column, 'test''s', 'test');
答案 1 :(得分:0)
试试这个
UPDATE table
SET column = REPLACE(column, 'test''s', 'test');
或者
UPDATE table
SET column = REPLACE(column, 'test\'s', 'test');
或者
UPDATE table
SET column = REPLACE(column, e'test\'s', 'test');