After reading your subject line again, I can see another method that may be
more inline with trimming:
SELECT TRIM(LEADING 'A' FROM
TRIM(LEADING 'B' FROM
TRIM(LEADING 'C' FROM myField)))
FROM myLib/myFile
Elvis
Celebrating 10-Years of SQL Performance Excellence on IBM i5/OS and OS/400
http://centerfieldtechnology.com/training.asp
-----Original Message-----
Subject: RE: SQL question - trim leading alphabetic characters
Based solely on the sample set you provided, this ought to work:
SELECT REPLACE(REPLACE(myField,'ABC',''),'A','') FROM myLib/myFile
If you're on a release that doesn't support REPLACE function, look into
TRANSLATE.
Elvis
Celebrating 10-Years of SQL Performance Excellence on IBM i5/OS and OS/400
http://centerfieldtechnology.com/training.asp
-----Original Message-----
Subject: SQL question - trim leading alphabetic characters
Does SQL have a relatively easy way to do this mapping?
ABC123 -> 123
ABC123DEF -> 123DEF
A1B2 -> 1B2
...
I've done something similar before as a "one off", but I can't remember
whether it was an RPG program or SQL or SEQUEL. Of course, now needed
again (one year later), I can't find the object!
TIA,
As an Amazon Associate we earn from qualifying purchases.