Luka Luka - 1 month ago 10
SQL Question

Replace character in whole table in SQL Server

I would like ask you how I can replace 1 character in the whole table?

I want replace character which is

©
and change it to
Š


I found : http://www.sqlteam.com/article/using-replace-in-an-update-statement

I read lot of staff but i found code for replacing character only one column in whole table.. I try add names of columns to line but that does not work..

I have :

Column1 Column2 Column3
©pple ©og ©ook


I need:

Column1 Column2 Column3
Špple Šog Šook


Thanks for any opinion

Answer

You can update multiple fields at once in your UPDATE statement.

UPDATE dbo.authors
SET    city = replace(city, 'Salt', 'Olympic')
     , city2 = replace(city2, 'Salt', 'Olympic')
     , city3 = replace(city3, 'Salt', 'Olympic')
     , ...