REPLACE

Applies to: ✅ Data 360 SQL ✅ Tableau Hyper API

Replaces all occurrences of a substring with another substring.

Syntax 

1replace(<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.

1SELECT replace('abcdefabcdef', 'cd', 'XX') AS result;

Returns 'abXXefabXXef'.

Related Documentation 

DID THIS ARTICLE SOLVE YOUR ISSUE?
Let us know so we can improve!