REPLACE (Azure Cosmos DB)

APPLIES TO: SQL API

Replaces all occurrences of a specified string value with another string value.

Syntax

REPLACE(<str_expr1>, <str_expr2>, <str_expr3>)  

Arguments

str_expr1
Is the string expression to be searched.

str_expr2
Is the string expression to be found.

str_expr3
Is the string expression to replace occurrences of str_expr2 in str_expr1.

Return types

Returns a string expression.

Examples

The following example shows how to use REPLACE in a query.

SELECT REPLACE("This is a Test", "Test", "desk") AS replace

Here is the result set.

[{"replace": "This is a desk"}]  

Remarks

This system function will not utilize the index.

Next steps