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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to insert the value /u11

Status
Not open for further replies.

maxcrook

Programmer
Jan 25, 2001
210
GB
I need to insert the value (using sql) /u11 into a row called PATHNAME

The table is called managed

At the moment the values in PATHNAME state:
/work/figures/GF.nnnnn.GMF

Where nnnnnn = the number in the row GMF_ID

How can I add the value /u11 to make the PATHNAME values show:
/u11/work/figures/GF.nnnnn.GMF

Urgent reply if possible.

Thanks

Max
 
UPDATE managed
SET pathname = '/u11'||pathname;

This assumes you meant you were updating a column named pathname (rather than a row named pathname).

Also, this statement will update all rows in the table; if you want to be more specific you will have to include an appropriate WHERE clause.
 
Great thanks unfortunately some rows already contained /u11
How can i get rid of those

where pathname /u11/u11

Thanks

Max
 
Try this:

UPDATE managed
SET pathname = SUBSTR(pasthname,5)
WHERE pathname like '/u11/u11%'

I think that will do it. Might want to tryit as a select first...
Terry M. Hoey
th3856@txmail.sbc.com
While I don't mind e-mail messages, please post all questions in these forums for the benefit of all members.
 
This is the WHERE clause that I mentioned you might need:

UPDATE managed
SET pathname = '/u11'||pathname
WHERE pathname NOT LIKE '/u11%';
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top