✅ Azure 流分析 ✅ 构造事件流
将出现的所有指定字符串值替换为另一个字符串值。
语法
REPLACE ( stringExpression, stringPattern, stringReplacement )
论据
stringExpression
要搜索的字符串表达式。
stringPattern
要找到的子字符串。 如果 stringPattern 是空字符串,则返回 stringExpression 。
stringReplacement
替换字符串。
返回类型
如果任一参数为 NULL,则返回 NULL。 否则,返回 nvarchar(max)。
例子
SELECT REPLACE(value, pattern, replacement) AS result FROM input
表达式 | 结果 |
---|---|
REPLACE('abcde', 'cd', 'xx') | “abxxe” |
REPLACE('cdabcd'、'cd'、'x') | “xabx” |
REPLACE('cd', 'cd', 'xxx') | “xxx” |
REPLACE('abcde'、'gh'、'xx') | “abcde” |
REPLACE('abcde', 'cde', '') | “ab” |
REPLACE('abcde'、''、'xxx') | “abcde” |
REPLACE('、'cde'、'xxx') | '' |
REPLACE(NULL、'cde'、'xxx') | null |
REPLACE('abcde', NULL, 'xxx') | null |
REPLACE('abcde'、'cde'、NULL) | null |