Export (0) Print
Expand All

REPLACE

SQL Server 2000

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

Syntax
REPLACE ( 'string_expression1' , 'string_expression2' , 'string_expression3' )
Arguments
'string_expression1'
Is the string expression to be searched. string_expression1 can be of data types that are implicitly convertible to nvarchar or ntext.
'string_expression2'
Is the string expression to try to find. string_expression2 can be of data types that are implicitly convertible to nvarchar or ntext.
'string_expression3'
Is the replacement string expression. string_expression3 can be of data types that are implicitly convertible to nvarchar or ntext.
Return Types

nvarchar or ntext

Examples

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

Show:
© 2014 Microsoft