ISNUMERIC() in SQL

March 11, 2009 at 05:26:15
Specs: Windows XP
Hello,
I am having an table with the column type as
varchar.
The column value may be anything.Its include
numbers,Strings,*,#,%.etc..
But i like to gee the values which is in between
0 to 100.
So i tried as
[code]select attribute2 from history where
ISNUMERIC(attribute2)=1 and cast(Attribute2
as integer) < cast('100' as integer) and
cast(Attribute2 as integer) > cast('0' as
integer)--attribute2<>100[/code]
Here
attribute2 - column name varchar
History - table name

Its giving the following error "cannot convert #
to int".
But i am filtering the column values by
ISNUMERIC(attribute2)=1 before casting to
integer.
Please any one guide me to solve this issue!!!

Thank you!!!



See More: ISNUMERIC() in SQL

Report •


#1
March 11, 2009 at 07:56:42
WHERE CASE
WHEN isnumeric (attribute2) = 1
THEN CAST (attribute2 AS INTEGER)
END BETWEEN 1 AND 99

Report •
Related Solutions


Ask Question