Export (0) Print
Expand All
Expand Minimize
1 out of 2 rated this helpful - Rate this topic

REPLACE (SQL Server Compact)

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([Product Name], 'Anton', 'Anthony')
FROM Products
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.