0

I have the following queries.

    select ISNUMERIC(result+ 'E0'), from t1  
    select ISNUMERIC('7' + 'E0') 
    select ISNUMERIC('7' + '.E0') 

The data type of result column is varchar(50).The first query yields 0 even when result is like 2,3 and returns 1 for float only ...Whereas second and third query works fine for both integer and float.Am I missing anything? My requirement is to check whether result column is number(integer,float) or not.I know isnumeric returns 1 for type like money,small money,real etc but this is not the case here as i don't have such type in my result and i am only receiving 0.

xyz
  • 762
  • 7
  • 24

1 Answers1

1

The reason for the seemingly inconsistent result might be, that there is a space in your result column value. Try timming text and feed the trimmed text to ISNUMERIC:

select ISNUMERIC(ltrim(rtrim(result))+ 'E0') from t1
Sascha
  • 1,210
  • 1
  • 17
  • 33
  • Thanks.You are right it's because of space. It works but when I tried to copy the cell data and paste in notepad and other editor I could not find space. – xyz Dec 07 '15 at 13:31