Meandyou
1840 pts. | Jul 30 2009 1:37PM GMT
I did not recall the “IS_NUMERIC” function. To my knowledge this must be outside the ANSI standards.
By definition, in an RDBMS, if one wants numbers then one should use a numeric data type such as INTEGER, DECIMAL, FLOAT or whatever is appropriate for your data and within the confines of your particular RDBMS. A VARCHAR column, again by definition, can contain any characters.
One old approach to your problem that I recall involved a CASE statement and substringing thru the column one character at a time …
,CASE
WHEN ONE_CHAR BETWEEN ‘0′ AND ‘9′ THEN ‘NUMBER’
But If it is important to know if a CHARACTER column contains NUMERICS, then I would contend that something is wrong with the design of your system or application
Carlosdl
29805 pts. | Jul 30 2009 3:22PM GMT
You are right Meandyou, it is not a standard function. I think it is a t-sql function, but actually the function is ISNUMERIC() not IS_NUMERIC().
Depending on the RDBMS, there could be different ways to do it.
In Oracle, for example, one option could be performing a to_number() conversion, and catching the specific error (ORA-06502) that should be thrown if the argument wasn’t numeric.






