REPLACE
Published: 3rd May 2013
This is a very common function when performing string manipulation… you simply pass in a character or string that you wish SQL to look for, the text in which to look, and what you want the character or string replacing with.

Character replace



declare @text varchar(40)
set @text = 'mom'

select replace(@text, 'm', 'b')


String replace



declare @text varchar(40)
set @text = 'flash'

select replace(@text, 'la', 'i')


Comments:
NB: Comments will only appear once they have been moderated.