Quantcast
Channel: Microsoft SQL Server
Viewing all articles
Browse latest Browse all 4871

UPDATE REPLACE text string query help

$
0
0

This should be some easy points for someone.

Data on a server is being migrated soon. Links to files on the migrating server are in different tables in a database. I'm looking to make an update query to change server names while leaving the rest of the path alone.

My first attempt (on a test system) resulted in restoring from backup.
UPDATE table
SET field = REPLACE ('\\oldserver\', 'oldserver', 'newserver')
Those 2 lines made every record in the table "\\newserver\" only; even ones that didn't match 'oldserver'.

What's the proper way to update the server part of the path while retaining the folder portion?

While one table has a path as a field, another table has the path in a memo field along with lots of other text. Would there be any difference in the query to update?

Thanks in advance.


Viewing all articles
Browse latest Browse all 4871

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>