Solved

Script to change value in mssql

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

746 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now