Applies to: ✅ Data 360 SQL ✅ Tableau Hyper API
Replaces all occurrences of a substring with another substring.
Syntax
replace(<string>, <from>, <to>)
Arguments
Required
<string>: The source string.<from>: The substring to find.<to>: The replacement substring.
Returns
Returns a text value with all occurrences replaced.
Considerations
- Replaces all occurrences, not just the first.
- Replacement is case-sensitive.
Examples
Replace Substring
Replace all occurrences of a substring.
SELECT replace('abcdefabcdef', 'cd', 'XX') AS result;
Returns 'abXXefabXXef'.