MIDRANGE dot COM Mailing List Archive



Home » MIDRANGE-L » September 2012

Re: SQL select records with numeric strings



fixed

On Mon, Sep 17, 2012 at 12:41 PM, Luis Rodriguez <luisro58@xxxxxxxxx> wrote:
SELECT * FROM TEXTFILE WHERE TRANSLATE(TEXT, ' ',
'1234567890') = ' '

If the result is ' ', the field contains only numbers.

But he wants to find fields which can contain both text and numbers,
and the numbers contained are 9 digits long.

This is another one of those "easy to do with regular expressions"
problems that is more convoluted if you don't have regex.

Off the cuff, I'd say your approach could still be used, sort of, in two steps:

First, convert all the digits to some "conspicuous" character
(preferably one that can't appear in the data anywhere else). Second,
search for a string of 9 of those characters.

John





Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2014 by MIDRANGE dot 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 here. If you have questions about this, please contact