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!

SQL for converting a CHAR(15) field

Status
Not open for further replies.

legend8

MIS
Joined
Jan 30, 2001
Messages
36
Location
CA
Hi all,
I'm wondering if it is possible to do the following with DB2:

Trim and remove all the special charaters (including spaces) in a CHAR(15) field so that it contains only characters like A-Z and 0-9. For example:

' AB 123-456' converts to 'AB123456'

Can this be done in DB2 SQL?
Any idea is appreciated.

Legend8
 
Yes, I believe it can be done.
Look at functions:
TRANSLATE, POSSTR, RTRIM, LTRIM, SUBSTR

Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top