I am trying to cast/ convert varchar to a numeric value. I have done this succesfuly when I eval the lower range, however I get an error when I do the upper range.

this is my evaluation section that works.

isnull(cast(measurmentdata.measvalue as numeric),0) < productinfo.lowerrange

however when I try to test to see if it is above the upper range it throws an error

isnull(cast(measurmentdata.measvalue as numeric),0)  >  productinfo.upperrange

I have tried not between as well. while it does not return any errors it does not correctly test for > or <

isnull(cast(measurmentdata.measvalue as numeric),0) not between     productinfo.lowerrange and productinfo.upperrange

Edited by Joe_10

7 Months
Discussion Span
Last Post by Sai_421

What is the error message from the second statement? Also, double check your data types for productinfo.lowerrange and productinfo.upperrange and make sure they have the same data type, precision and scale numbers.

Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.