Tuesday, 17 July 2018

Sql Server REPLACE


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

Interactive CSS Button Designer Tool – Free & Fast

What is Button ?                               Button  is an element of HTML. HTML is used to design Web Page and Website and Web applicatio...