Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Update and replace function

Author  Topic 

bevans
Starting Member

10 Posts

Posted - 2012-03-09 : 02:20:53
I have a column called 'Folder' in a table called 'FileLocation'
There are a list of entries in this column.
The table looks like this:
'Column : Name' 'Column: Folder
XML Templates \\test-apps\xml
Stats Values \\test-apps\stats

The file path has changed for all of the entries, 'test-apps' has been changed to 'testing-env' how do i write a script that updates that value?

So I would like the table to look like this:
'Column : Name' 'Column: Folder
XML Templates \\testing-env\xml
Stats Values \\testing-env\stats

Thanks

shaggy
Posting Yak Master

248 Posts

Posted - 2012-03-09 : 02:27:34
update FileLocation
set Folder = replace(Folder,'test-apps' ,'testing-env' )
Go to Top of Page
   

- Advertisement -