REPLACE

All functions > STRING > REPLACE

Replaces all occurrences of a substring with another substring.

Syntax

REPLACE(expr, search, replace)
sql

Arguments

ParameterTypeRequiredDescription
stringVARCHARYesString to search in
searchVARCHARYesSubstring to find
replacementVARCHARNoString 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

Examples

Last update at: 2025/10/13 10:23:46