Replace SQL | Replace Function in SQL - sql - sql tutorial - learn sql
- The Replace function in SQL is used to update the content of a string.
- The function call is REPLACE( ) for MySQL, Oracle, and SQL Server.
- In SQL Server (Transact-SQL), the REPLACE function replaces a sequence of characters in a string with another set of characters, not case-sensitive.
- The Replace function in SQL is used to update the content of a string.
- The function call is REPLACE( ) for MySQL, Oracle, and SQL Server.
sql tutorial , pl sql tutorial , mysql tutorial , oracle tutorial , learn sql , sql server tutorialSyntax:
Syntax:
- The syntax of the Replace function in SQL is:
REPLACE (str1, str2, str3)
- In str1, find where str2 occurs, and replace it with str3.
sql tutorial , pl sql tutorial , mysql tutorial , oracle tutorial , learn sql , sql server tutorialExample
Example
- We use the following table as our example.
Table Geography
Region_Name | Store_Name |
---|---|
North | Los Angeles |
North | New York |
South | Boston |
South | San Diego |
- If we apply the following Replace function:
SELECT REPLACE (Region_Name, 'rth', 'rthern') REGION1
FROM Geography;
- We get the result as,
REGION1 |
---|
Northern |
Northern |
South |
South |
Tags : sql tutorial , pl sql tutorial , mysql tutorial , oracle tutorial , learn sql , sql server tutorialSQL String Replace Function Example
SQL String Replace Function Example
