Any argument to the REPLACE function must be of
a built-in data type.
The REPLACE function returns a copy of source_string in
which every occurrence of old_string is replaced by new_string.
If you omit the new_string option, every occurrence of old_string is
omitted from the return string.
The return data type is its source_string argument.
If a host variable is the source, the return value is either NVARCHAR
or NCHAR, according to the length of the returned string, using the
return type promotion rules that the section Return Types from the CONCAT
Function describes.
In the following example, the REPLACE function
replaces every occurrence of xz in the source string
with t:
SELECT REPLACE('Mighxzy xzime', 'xz', 't')
FROM mytable;
The following table shows the output of this SELECT statement.