REPLACE
All functions > STRING > REPLACE
Replaces all occurrences of a substring with another substring.
Syntax
REPLACE(expr, search, replace)
sql
Arguments
Parameter | Type | Required | Description |
---|---|---|---|
string | VARCHAR | Yes | String to search in |
search | VARCHAR | Yes | Substring to find |
replacement | VARCHAR | No | String to replace with (optional, defaults to empty string) |
Returns
String with all occurrences replaced
Notes
- Replaces ALL occurrences, not just the first
- Case-sensitive search
- If replacement is omitted, removes the search string
- If search string is not found, returns original string unchanged