Features


Tuesday, May 13, 2008

REPLACE (Transact-SQL)

Replaces all occurrences of a specified string value with another string value.

ex.

Url Value = "http://www.samplewebsite.com/left/right/getch/"

I want to remove the http://www.samplewebsite.com/ and change it to http://www.minewebsite.com/

Query Sample :

update tbl_URLs set url = replace(url,'http://www.samplewebsite.com/','http://www.minewebsite.com/')

the output must be:
http://www.minewebsite.com/left/right/getch/

Hope this will help.

No comments: