0

When I select from a view, I get an error:

Error converting data type varchar to float.

Query:

select cast(myNumVal as float) myFloatVal 
from uvw_myView 

When I execute it this, however, it works, no errors

select 
    cast(myNumVal as float) myFloatVal,  
    CASE 
        WHEN ISNUMERIC(myNumVal + 'e0') = 0 THEN myNumVal 
        ELSE null 
    END AS MyVarchar
from uvw_myView

The two queries are identical, with the exception of the additional column in the latter. Can somebody explain why this is happening?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Tom McDonald
  • 1,532
  • 2
  • 18
  • 37

0 Answers0