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.
Author |
Topic |
shucks
Starting Member
5 Posts |
Posted - 2009-04-29 : 19:30:59
|
Hi There,I have a problem where I have a huge bunch of files which I need to move to a new server location. This can be done manually how ever I have to change the path in the database and the path needs to contain the file names. Each member in the table obiously has a different file name. I thought i could just update the path to all read the same path name but no. For instance there is 3 members. They currently have these three paths. \\sfap773citr\folder1\123.pdf \\sfap773citr\folder1\345.pdf \\sfap773citr\folder1\678.pdfThey all need to go into the same location eg. \\dfnewserver\fodler1\123.pdf \\dfnewserver\fodler1\345.pdf \\dfnewserver\fodler1\678.pdfApparently I need to use both padindex and substring to find the pattern and update thousands of files in one hit. How do I do this?Thank you. |
|
shucks
Starting Member
5 Posts |
Posted - 2009-04-29 : 23:55:40
|
I am not sure how to edit the existing note so I am adding a reply. I may have not been clear. There are basically pdf files. each member has one pdf with a file name of their member number. For instance 123.pdf is member number 123. The location of the path is currently \\dsffserver\destination 1\123.pdfThe path needs to change to \\dsserver2\destination\123.pdfIf there were only a couple of member paths to change it would be easy. I could just do one at a time. update table set path = \\dsserver2\destination\123.pdf where path = \\dsffserver\destination 1\123.pdf.The thing is there are thousands. So how can I say replace all these member path names to the new server destination. Someone has hinted I need to use padindex but I've never used this before. Thanks in advance |
 |
|
shucks
Starting Member
5 Posts |
Posted - 2009-04-30 : 01:02:33
|
or maybe there is an easier way to do a find and replace, that way I could leave the pdf name bu replace everything before it with new values. Surely that would be easy? |
 |
|
shucks
Starting Member
5 Posts |
Posted - 2009-05-03 : 22:32:58
|
I worked out another way to do what I needed.I ended up using the replace function to replace part of the ath, leaving the file names at the end. |
 |
|
|
|
|