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 |
mimic
Starting Member
18 Posts |
Posted - 2007-11-05 : 02:17:58
|
I have to move some files from one computer to another.The path to those files (\\server1\share1\...) is stored in a table product in a field ... drawing. Not all products have a drawing in that table.I need to write an Sql that will replace the part of the string (\\server1\share1\) in that table with another (\\server2\share2\).Can you help me? |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-11-05 : 02:51:32
|
UPDATE Table1SET Col1 = REPLACE(Col1, '\\server1\share1\', '\\server2\share2\')where col1 like '\\server1\share1\%' E 12°55'05.25"N 56°04'39.16" |
 |
|
mimic
Starting Member
18 Posts |
Posted - 2007-11-05 : 03:09:55
|
will this replace all the file names(server1\share1\...\file1 , ...file2) into (server2\share2\...\file1 , .. file2)? |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-11-05 : 03:16:21
|
<irony>No, my update statement will format your harddrives and get you some more coffee</irony>Yes, it will work. Did you try it? E 12°55'05.25"N 56°04'39.16" |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-11-05 : 03:17:47
|
quote: Originally posted by mimic will this replace all the file names(server1\share1\...\file1 , ...file2) into (server2\share2\...\file1 , .. file2)?
Yes. If you have doubt, write select statement and seeMadhivananFailing to plan is Planning to fail |
 |
|
mimic
Starting Member
18 Posts |
Posted - 2007-11-05 : 03:44:18
|
Thanks, i will try it. I was expecting something like trim(field1, start_char,end_char) and then field1 = '\\server2\share2\'+ field1 ... :-)Thanks again! |
 |
|
|
|
|