我在字符串中有一个值:Children's play ground
。我想将'
替换为%
。所以我用
replace(columnname, '''', '%')
replace(columnname, '', '%')
也不起作用。
答案 0 :(得分:1)
DECLARE @NAME VARCHAR(100) = 'Children''s play ground'
CREATE TABLE #TMP(TEXT1 VARCHAR(50))
INSERT INTO #TMP
SELECT @NAME
SELECT TEXT1 FROM #TMP
SELECT REPLACE(TEXT1,'''','%') FROM #TMP
答案 1 :(得分:0)
试试这个
DECLARE @str VARCHAR(50);
SET @str = 'Children''s play ground'
SELECT @str
SET @str = REPLACE(@str, '''', '%')
SELECT @str;