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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Updating a text field

Author  Topic 

kashy
Starting Member

12 Posts

Posted - 2007-02-02 : 06:46:12
I have a complex issue that has several steps.

Question 1.
I need to be able to update the following path in the database, a text field

[Info] NumAttachments=1 [Attachments] Attachment1=65513|C:\Program Files\HEAT\HEATSelfService\attachments\Winter019997.htm

I need to update the path only to H:\2007|( Winter019997.htm)Filename as in database.

Question 2
This needs to be done automatically so when attachments are being added this updates. How can I do this?

Question 3
I have the attachments saved in this location C:\Program Files etc… I need them moved to another location on the network. How can I do this?

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-02-02 : 09:14:23
Why do you use a text field? Use a VARCHAR instead. No path can be longer than 256 characters anyway.
And this kind of question has been answered last week.
Do a search.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2007-02-02 : 09:32:50
Have a look at this - it shows how to update text columns.
http://www.nigelrivett.net/SQLTsql/ReplaceText2.html

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

kashy
Starting Member

12 Posts

Posted - 2007-02-02 : 09:32:57
I have not designed the Db so have to work with a text field. I tried that from previous post but that does not update the field correctly it does not take into account the first part of the field where - [Info] NumAttachments=1, so this way all attachment are cleared.
Go to Top of Page

snSQL
Master Smack Fu Yak Hacker

1837 Posts

Posted - 2007-02-02 : 11:40:21
quote:
I tried that from previous post but that does not update the field correctly it does not take into account the first part of the field where - [Info] NumAttachments=1, so this way all attachment are cleared.

Have you tried that code and set the values for old and new like this
select @old = 'C:\Program Files\HEAT\HEATSelfService\attachments',
@new = 'H:\2007'

That should update just the path in the text fields and leave everything else alone.
Go to Top of Page
   

- Advertisement -