Sql string replace

I would like to find and replace string in a column.
For example: TableA   MyColumn (varchar(50))
Replace USA with GB
Id=2   MyColumn: GER, USA, INDIA
Id=3   MyColumn: CHINA, INDIA, USA
The result should be:  
Id=2  MyColumn: GER, GB, INDIA
Id=3  MyColumn: CHINA, INDIA, GB
How is best to do this?
Who is Participating?
kamindaConnect With a Mentor Commented:
You can use the Replace function in SQL to do this. It is the easiest and fastest way to do this,

SELECT REPLACE(MyColumn,'USA', 'GB') FROM yourTableName
AdamConnect With a Mentor Senior DeveloperCommented:
The above solution works if you want to leave the data unchanged

If you want to actually change the data, use:

update TableA set MyColumn = REPLACE(MyColumn,'USA', 'GB')

Open in new window

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.