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 |
icw
Constraint Violating Yak Guru
378 Posts |
Posted - 2006-08-24 : 07:49:10
|
Hi I want to update a field - partially!.What i mean is;currently the field will contain a path to a file e.g.'\\Old_server1\files\customer1\test.xls'I want to do an update query to update the first part;so that it looks like;\\New_server2\files\customer1\test.xlsCan I do this somehow?Thanks |
|
chiragkhabaria
Master Smack Fu Yak Hacker
1907 Posts |
Posted - 2006-08-24 : 07:51:36
|
??Update TableName Set Columnname = replace(ColumnName,'Old_server1','New_server2') Chirag |
 |
|
icw
Constraint Violating Yak Guru
378 Posts |
Posted - 2006-08-24 : 08:24:57
|
I don't think I explained properly.The whole path stored is a string not individual columnsthanksICW |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-08-24 : 08:27:19
|
Update TableName Set FIELD = replace(FIELD, 'Old_server1', 'New_server2')Peter LarssonHelsingborg, Sweden |
 |
|
icw
Constraint Violating Yak Guru
378 Posts |
Posted - 2006-08-24 : 08:52:53
|
Thanks to you both actually,I didn't realise at first the first response answered my question too.icw |
 |
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2006-08-24 : 08:53:08
|
quote: Originally posted by icw I don't think I explained properly.The whole path stored is a string not individual columnsthanksICW
you need to read about replace function in BOL...Chirag or peso's query will replace word 'Old_server1', wherever found in the path, with the word 'New_server2'. It is not replacing the individual column !!Harsh AthalyeIndia."Nothing is Impossible" |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-08-24 : 08:54:41
|
All I did was to replace COLUMN to FIELD.Not all Access developers understands this is the same.Peter LarssonHelsingborg, Sweden |
 |
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2006-08-24 : 11:12:11
|
quote: Originally posted by Peso All I did was to replace COLUMN to FIELD.Not all Access developers understands this is the same.Peter LarssonHelsingborg, Sweden
I didn't blame you...but how do you know he/she is an Access developer Harsh AthalyeIndia."Nothing is Impossible" |
 |
|
|
|
|