Tuesday, August 18, 2015

T-SQL Replace Every Occurrence of Specific Text in a Column with Other Text

This syntax can be used to replace any instance of a word or string of some specific text that appears anywhere in a column (in any row) with some other text. 

To make a global change to column "Comment":

update MyTable set Comment = replace (Comment ,'all instances','any instance'

This selective edit came in very handy the other day.

No comments:

Post a Comment