Solved

Script to change value in mssql

Posted on 2010-11-23
2
269 Views
Last Modified: 2012-05-10
Hi.
I Want to change a part of a value in one of my table.
The table consist of lots of paths to documents, and when i now change the path i need to change all of the values.
ie:

C:\documents\F0001\document1.txt
C:\documents\F0001\document2.txt
to
d:\new\F9999\document1.txt
d:\new\F9999\document2.txt

I want to change the C:\documents\F0001 part to d:\new\F9999.

any suggestions?
0
Comment
Question by:valeoit
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 19

Accepted Solution

by:
Bhavesh Shah earned 500 total points
ID: 34196825
Hi,

If thats is hardcode you can do

UPDATE TABLE
SET file = REPLACE(FILE,'C:\documents\F0001','D:\new\F9999')
WHERE FILE LIKE 'C:\documents\F0001%'
0
 

Author Comment

by:valeoit
ID: 34196882
Thanks for quick answer.
0

Featured Post

Free eBook: Backup on AWS

Everything you need to know about backup and disaster recovery with AWS, for FREE!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question