REPLACE (Azure Stream Analytics)
Replaces all occurrences of a specified string value with another string value.
Syntax
REPLACE ( stringExpression, stringPattern, stringReplacement )
Arguments
stringExpression
The string expression to be searched.
stringPattern
The substring to be found. If stringPattern is an empty string, then stringExpression is returned.
stringReplacement
The replacement string.
Return Types
Returns NULL if any of the arguments are NULL. Otherwise, returns nvarchar(max).
Examples
SELECT REPLACE(value, pattern, replacement) AS result FROM input
Expression | Result |
---|---|
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 |
See Also
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for