views:

1553

answers:

2

i have a table (SQL Sever, in this case) which references paths (UNC or otherwise), but now the path is going to change. In the path column, I have many records and I need to change just a portion of the path, but not the entire path. And - I need to change the same string to the new one, in every record.

How can i do this with a simple update?

+5  A: 

Its this easy:

update table
set path = replace(path, 'oldstring', 'newstring')
ck
thank you, i just needed it very quickly
DaDa
d'oh! I wasn't quite fast enough ;-p
Marc Gravell
+1  A: 
UPDATE [table]
SET [column] = REPLACE([column], '/foo/', '/bar/')
Marc Gravell