SQL Server REPLACE() Function

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP







<!--
main_leaderboard, all: [728,90][970,90][320,50][468,60]
-->



SQL Server REPLACE() Function




❮ SQL Server Functions



Example


Replace "T" with "M":



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

Try it Yourself »


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









Parameter Description
string Required. The original string
old_string
Required. The string to be replaced
new_string
Required. The new replacement string

Technical Details




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

More Examples



Example


Replace "SQL" with "HTML":



SELECT REPLACE('SQL Tutorial', 'SQL', 'HTML');

Try it Yourself »



Example


Replace "a" with "c":



SELECT REPLACE('ABC ABC ABC', 'a', 'c');

Try it Yourself »





❮ SQL Server Functions


Popular posts from this blog

Malaysia to Papua New Guinea by motorcycle?

List of Bhojpuri films

PHP code is not being executed, instead code shows on the page