Export (0) Print
Expand All
Expand Minimize

REPLACE (SQL Server Compact Edition)

Replaces all occurrences of the second given string expression in the first string expression with a third expression.


REPLACE ( 'string_expression1' , 'string_expression2' , 'string_expression3' )

' string_expression1 '

The string expression to be searched. The string_expression1 argument can be of data types that are implicitly convertible to nvarchar or ntext.

' string_expression2 '

The string expression to try to find. The string_expression2 argument can be of data types that are implicitly convertible to nvarchar or ntext.

' string_expression3 '

The replacement string expression. The string_expression3 argument can be of data types that are implicitly convertible to nvarchar or ntext.

nvarchar or ntext

Returns NULL if any of the arguments is NULL.

The following example searches for the name "Anton" in the list of product names and replaces it with "Anthony".

SELECT REPLACE(ProductName, 'Anton', 'Anthony')
FROM Products
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2015 Microsoft