|
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. The syntax of the Replace function is:
Replace(str1, str2, str3): In str1, find where str2 occurs, and replace it with str3.
Assume we have the following table:
Table Geography
| region_name |
store_name |
| East |
Boston |
| East |
New York |
| West |
Los Angeles |
| West |
San Diego |
If we apply the following Replace function:
SELECT REPLACE(region_name, 'ast', 'astern') FROM Geography;
Result:
| region_name |
| Eastern |
| Eastern |
| West |
| West |
SQL DATEADD >>
Link to this page: If you find this page useful, we encourage you to link to this page. Simply copy and paste the code below to your website, blog, or profile.
Copyright 2010 1keydata.com. All Rights Reserved. Privacy Policy
|