bugl
bugl
HomeLearnPatternsPathsSearchPremium
HomeLearnPatternsPaths

Loading lesson path

Learn/SQL/SQL References
SQL•SQL References

SQL Server REPLACE() Function

Example

SELECT REPLACE('SQL Tutorial', 'T', 'M');

Definition and Usage

The REPLACE() function replaces all occurrences of a substring within a string, with a new substring.

Note

The search is case-insensitive.

Tip

Also look at the STUFF() function.

Syntax

REPLACE(
string
,
old_string
,
new_string
)

Parameter Values

ParameterDescription
stringRequired. The original string
old_stringRequired. The string to be replaced
new_stringRequired. The new replacement string

Technical Details

Works in:SQL Server (starting with 2008), Azure SQL Database, Azure SQL Data Warehouse, Parallel Data Warehouse

Previous

SQL Server QUOTENAME() Function

Next

SQL Server REPLICATE() Function