× 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.



On 03-Jun-2010 06:12, Birgitta Hauser wrote:

<<SNIP>>

To test for invalid numeric values you may run the following
query:

Select CharacterField
From Table
Where
Length(Trim(
Translate(CharacterField, ' ', '1234567890')
) ) > 0


FWiW, that expression is only sufficient to determine which character field values do not represent valid _positive_ integers; i.e. valid character representation of negative integer values would be selected by that predicate. If the character field includes a left-negative sign for a valid integer value, the [implicit] cast to numeric would occur without error.

I did not test, but I expect that...

The following expression would strip the minus sign, but the predicate would not be able to detect the case where spaces occur between the minus sign and\or the digits:

where
translate( strip(trim(CharacterField), L, '-')
, ' '
, '1234567890') <> ''

To solve the issue with embedded blanks, the Length() could be introduced in the above expression just as in the quoted message, or any remaining blanks could be converted to a non-blank [e.g. an asterisk]:

where
translate( strip(trim(CharacterField), L, '-')
, ' *'
, '1234567890 ') <> ''

Regards, Chuck

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 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.