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 - 2009-02-07 : 00:50:33
|
| HiI have a text field (Gdetail) in a table (Heatgen)that contains filepaths in amongst other infoe.g. '[Info] NumAttachments=1 [Attachments] Attachment1=Water lilies.jpg|C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Water lilies.jpg'The attachments have all been moved to a new folder so i need to update the database to change 'C:\Old Folder\' to 'P:\New folder\'The replace function would be ideal - if it worked on a text field.is there an alternative for a text field |
|
|
icw
Constraint Violating Yak Guru
378 Posts |
Posted - 2009-02-07 : 01:08:22
|
| Hii just figured this out. it seems to work. can anyone confim please that i am right to do this...SELECT REPLACE(Cast(HeatGen.GDetail as varchar(max)), 'C:\Old', 'P:\New')FROM HEATGENWHERE HEATGen.GCode = 'AT' |
 |
|
|
Nageswar9
Aged Yak Warrior
600 Posts |
Posted - 2009-02-07 : 01:40:32
|
| Ok, I think its work fine |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-02-07 : 08:19:39
|
quote: Originally posted by icw Hii just figured this out. it seems to work. can anyone confim please that i am right to do this...SELECT REPLACE(Cast(HeatGen.GDetail as varchar(max)), 'C:\Old', 'P:\New')FROM HEATGENWHERE HEATGen.GCode = 'AT'
replace wont work with text datatype. you need to use thishttp://www.sqlteam.com/article/search-and-replace-in-a-text-column |
 |
|
|
|
|
|