Home All Groups Group Topic Archive Search About
Author
21 Jan 2006 7:44 PM
Sean John
How can I update data on this column called address1.  The path is
'c:\apps\MailBox\Attach\El Poder'
and I want it changed to
'c:\apps\Sever1\MailBox\Attach\El Poder'

*** Sent via Developersdex http://www.developersdex.com ***

Author
21 Jan 2006 8:02 PM
Jens
Hi Sean,

UPDATE SomeTable
SET address1 = 'c:\apps\Sever1\MailBox\Attach\El Poder'
WHERE address1 = 'c:\apps\MailBox\Attach\El Poder'


HTH, Jens Suessmeyer.
Author
21 Jan 2006 8:36 PM
Sean John
I'm sorry the path may different documents such as

I have a lot of documents that are in this location

c:\apps\MailBox\Attach\

and need them all switched to this location


c:\apps\Sever1\MailBox\Attach\

example
'c:\apps\MailBox\Attach\El Poder'
'c:\apps\MailBox\Attach\Word1.doc'
'c:\apps\MailBox\Attach\Word2.doc'
'c:\apps\MailBox\Attach\Word3.doc'
'c:\apps\MailBox\Attach\Word4.doc'
'c:\apps\MailBox\Attach\Word5.doc'

I need to change them to
c:\apps\Sever1\MailBox\Attach\Word1.doc'
c:\apps\Sever1\MailBox\Attach\Word2.doc'
c:\apps\Sever1\MailBox\Attach\Word3.doc'
c:\apps\Sever1\MailBox\Attach\Word4.doc'

Again its a lot of documents.  I update each one indivually I need to
update all




*** Sent via Developersdex http://www.developersdex.com ***
Author
21 Jan 2006 9:35 PM
Dean
sean,

based on your description, this should do:

create table paths(path varchar(50))
go

insert paths
select 'c:\apps\MailBox\Attach\El Poder'
union all
select 'c:\apps\MailBox\Attach\Word1.doc'
union all
select 'c:\apps\MailBox\Attach\Word2.doc'
union all
select 'c:\apps\MailBox\Attach\Word3.doc'
union all
select 'c:\apps\MailBox\Attach\Word4.doc'
union all
select 'c:\apps\MailBox\Attach\Word5.doc'

update paths
set path=stuff(path,9,0,'Server1\')

dean

Show quote
"Sean John" <s*@aol.com> wrote in message
news:eisIgpsHGHA.2896@TK2MSFTNGP09.phx.gbl...
> I'm sorry the path may different documents such as
>
> I have a lot of documents that are in this location
>
> c:\apps\MailBox\Attach\
>
> and need them all switched to this location
>
>
> c:\apps\Sever1\MailBox\Attach\
>
> example
> 'c:\apps\MailBox\Attach\El Poder'
> 'c:\apps\MailBox\Attach\Word1.doc'
> 'c:\apps\MailBox\Attach\Word2.doc'
> 'c:\apps\MailBox\Attach\Word3.doc'
> 'c:\apps\MailBox\Attach\Word4.doc'
> 'c:\apps\MailBox\Attach\Word5.doc'
>
> I need to change them to
> c:\apps\Sever1\MailBox\Attach\Word1.doc'
> c:\apps\Sever1\MailBox\Attach\Word2.doc'
> c:\apps\Sever1\MailBox\Attach\Word3.doc'
> c:\apps\Sever1\MailBox\Attach\Word4.doc'
>
> Again its a lot of documents.  I update each one indivually I need to
> update all
>
>
>
>
> *** Sent via Developersdex http://www.developersdex.com ***
Author
21 Jan 2006 9:39 PM
markc600
UPDATE SomeTable
SET address1 =
REPLACE(address1,'c:\apps\MailBox\Attach\','c:\apps\Sever1\MailBox\Attach\')
WHERE address1 like  'c:\apps\MailBox\Attach\%'
Author
22 Jan 2006 12:29 AM
Louis Davidson
While you can do the replace thing like a few other suggest (and will need
to for now,) there are really two problems here that you could solve with
normalization to make this easy:

1st, instead of one column to hold the whole path, break it up into multiple
columns, perhaps the path and the filename:

Path: 'c:\apps\MailBox\Attach\'
Filename: various per row

Then, based on this statement:
> Again its a lot of documents.  I update each one indivually I need to
> update all

It seems to me that you have some reason why you are storing all of these
files in the same place. If so, then you should pull the path out of the row
and move to another related table:

FileType
=======
FileType: MailAttachment
Path: 'c:\apps\MailBox\Attach\'

Files
=======
FileType: MailAttachment
Filename:

Now your problem is a snap. To get the file and path, just do a join.  It
might not be as simple as this, but usage will be much easier and cleaner
for future changes.

--
----------------------------------------------------------------------------
Louis Davidson - http://spaces.msn.com/members/drsql/
SQL Server MVP
"Arguments are to be avoided: they are always vulgar and often convincing."
(Oscar Wilde)

Show quote
"Sean John" <s*@aol.com> wrote in message
news:eisIgpsHGHA.2896@TK2MSFTNGP09.phx.gbl...
> I'm sorry the path may different documents such as
>
> I have a lot of documents that are in this location
>
> c:\apps\MailBox\Attach\
>
> and need them all switched to this location
>
>
> c:\apps\Sever1\MailBox\Attach\
>
> example
> 'c:\apps\MailBox\Attach\El Poder'
> 'c:\apps\MailBox\Attach\Word1.doc'
> 'c:\apps\MailBox\Attach\Word2.doc'
> 'c:\apps\MailBox\Attach\Word3.doc'
> 'c:\apps\MailBox\Attach\Word4.doc'
> 'c:\apps\MailBox\Attach\Word5.doc'
>
> I need to change them to
> c:\apps\Sever1\MailBox\Attach\Word1.doc'
> c:\apps\Sever1\MailBox\Attach\Word2.doc'
> c:\apps\Sever1\MailBox\Attach\Word3.doc'
> c:\apps\Sever1\MailBox\Attach\Word4.doc'
>
> Again its a lot of documents.  I update each one indivually I need to
> update all
>
>
>
>
> *** Sent via Developersdex http://www.developersdex.com ***

AddThis Social Bookmark Button