Replace searches for certain characters in a string and replaces with mentioned characters.
Syntax :
REPLACE(source String, string_to_replace, string_for_replacement)
source string : The source string.
string_to_replace : The string to search to replace.
string for replacement : The string to be come in place of string_to_replace.
Here is the example of REPLACE.
Example 1
SELECT
REPLACE('Hellow
World','ll',
'LL')
Result:
HeLLow World
Here is the example of REPLACE with update statement.
Example 2
UPDATE
student
SET
adress =
REPLACE(adress,
'City',
'LOCALITY')
WHERE
city='MyCity%'
No comments:
Post a Comment