【发布时间】:2019-08-29 08:33:48
【问题描述】:
需要更新所有具有子字符串的行,如下所示: 'forcestartpage=xx' 并将其替换为 'forcestartpage=18' * 子串前后有很多不应该改变的字符
试过了,不行:
update t_reminderscont
set body = REPLACE (body,'forcestartpage=__','forcestartpage=18')
谢谢
【问题讨论】:
-
“forcestartpage=XX”能否在您的值上重复多次?
-
通配符只能与
LIKE和PATINDEX等模式搜索运算符/函数一起使用。'_'中的REPLACE将仅被视为下划线字符,而不是单个字符通配符。 -
一些示例值也将对我们有很大帮助。我假设
forcestartpage的值不能大于 99,如果它小于 10,它将有一个前导 0(即'forcestartpage=08') -
不,只有一次(forcestartpage=XX)
标签: sql-server replace wildcard