How to replace a string in a SQL Server Table Column How to replace a string in a SQL Server Table Column sql-server sql-server

How to replace a string in a SQL Server Table Column


It's this easy:

update my_tableset path = replace(path, 'oldstring', 'newstring')


UPDATE [table]SET [column] = REPLACE([column], '/foo/', '/bar/')


I tried the above but it did not yield the correct result. The following one does:

update tableset path = replace(path, 'oldstring', 'newstring') where path = 'oldstring'