Replace
Replace all the second given string expressions in the first string expression with the third expression.
Syntax
Replace('String_expression1','String_expression2','String_expression3')
Parameters
'String_expression1'
String expression to be searched.String_expression1It can be character data or binary data.
'String_expression2'
String expression to be searched.String_expression2It can be character data or binary data.
'String_expression3'
String expression used for replacement.String_expression3It can be character data or binary data.
Return type
IfString_expression(1, 2, or 3) is one of the supported character data types, then the return character data. IfString_expression(1, 2, or 3) is supportedBinaryIf it is one of the data types, binary data is returned.
Example
In the following example, replace the string CDE in abcdefghi with xxx.
Select Replace ('abcdefghicde', 'cde', 'xxx') Go
The following is the result set:
------------ Abxxxfghixxx (1 row (s) affected)
See
Data Type
String Functions