Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to update one field with data from a different field, same record 1

Status
Not open for further replies.

dbrs4me

MIS
May 26, 2010
24
US
I need a script to update a field that holds a directory path, WORK_PATH. Right now this field holds a lot of 'F:\' and some longer UNC paths '\\server\dir\dir\username'. I need to update this field with a different UNC path, but I need that last value of the UNC path to be the USERID field from the same record.

Right now my WORK_PATH is F:\, when we move over I need it to be \\server2\DATA\Docs|TEMP\CHARLIE where CHARLIE is my USERID.

Thanks
 
Without additional confirmation of your specifications, I'll post the following code to begin helping you:
Code:
select * from dbrs4me;

WORK_PATH                           USERID
----------------------------------- -------
F:\                                 CHARLIE
\\server\dir\dir\username           PEGGY

2 rows selected.

update dbrs4me set work_path = '\\server2\DATA\Docs|TEMP\'||userid;

2 rows updated.

select * from dbrs4me;

WORK_PATH                           USERID
----------------------------------- -------
\\server2\DATA\Docs|TEMP\CHARLIE    CHARLIE
\\server2\DATA\Docs|TEMP\PEGGY      PEGGY

2 rows selected.
How different is this from what you wanted?


[santa]Mufasa
(aka Dave of Sandy, Utah, USA)
[I provide low-cost, remote Database Administration services: www.dasages.com]
“Beware of those that seek to protect you from harm or risk. The cost will be your freedoms and your liberty.”
 
dbrs4me -
Along with your "thank you", don't forget SM's purple star!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top