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

Syntax for 'Find and replace' in SQL 1

Status
Not open for further replies.
Joined
Nov 5, 2001
Messages
339
Location
GB
Hi,

I need to search for the text 'Org Unit n' or 'Org Unit nn' and replace it with 'n' or 'nn' where n is a number between 1 and 16. The same objective would be achieved by searching for 'Org Unit ' and replacing it with blank.

How can I do this using an SQL command?

Thanks for your help, Steve Phillips, Crystal Consultant
 
I'm rusty but.......
update tablename
set columname = substr(columname,9,2)
where substr(columname,1,8)= 'Org Unit'
HTH
;-)
Dickie Bird
db@dickiebird.freeserve.co.uk
 
Single columns

update table_name
set column_name = 'value'
[where condition];

Eg.

Update ORDERS
set QTY = 1
where ORDER_NUM = '23456';

Multiple columns

update table_name
set column1 = 'value',
[ column2 = 'value',]
[ column3 = 'value']
[where condition];

Eg.

update ORDERS
set QTY = 1,
CUST_ID = '221'
where ORDER_NUM = '12345';

Regards --
| Mike Nixon
| Unix Admin
| ----------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top