我想在SQL中使用replace命令将列文本Test替换为Test

时间:2016-04-05 03:00:49

标签: sql replace

我想在SQL中使用replace命令将列文本Test替换为Test。 我尝试过使用

UPDATE table 
    SET column = REPLACE(column, 'test's', 'test');

但是在测试中,它正在采取'作为额外报价。

2 个答案:

答案 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');