×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
> -----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
> ...
Elvis Budimlic wrote:
Based solely on the sample set you provided, this ought to work:
SELECT REPLACE(REPLACE(myField,'ABC',''),'A','') FROM myLib/myFile
Thanks Elvis. I wasn't quite clear enough. I want to trim any leading
alphabetic characters in order to sort by embedded numerics. Apparently
this makes counting parts in a poorly organized stock room easier at one
of our locations easier.
In regular expressions terms, I'm looking for something like this:
s/[A-Z]*([A-Z0-9]*)/\1/
I think I might be going to RPG for %scan + %subst. It just seems like
a lot of overhead for a once-per-year query.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact
[javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.