Update Column Value if the column Value contains and replace

I have a requirement where, I am trying to write a query that looks into my column Values and if a particular value is found then it changes them.

For Example if ABC or DEF is found then it is replaced by " "

DatabaseName: TestDB
TableName: Table1

Actual Data in the Table1

ColA
Test
Test1 ABC
Test2 DEF

This needs to be changed to something like,

ColA
Test
Test1
Test2

Upvotes: 0

Views: 431

Answers (1)

Juan Carlos Oropeza
Juan Carlos Oropeza

Reputation: 48177

update Table1
set ColA = replace(replace(ColA, 'ABC', ''), 'DEF', '')

Upvotes: 2

Related Questions