Solved

Script to change value in mssql

Posted on 2010-11-23
2
248 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
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
In this article I will describe the Backup & Restore 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.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

778 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