I have code in an sp (see below) that interrogates the field 'emvalue' that is a decimal datatype in my SQL table. In my 'Case' stmt in my sp, I want to convert it to a var character field and depending on the value of 'emvalue', put *'s in the field [StarCount]. However, I'm getting the error: "arithmetic overflow converting numeric to data type numberic" message. This error ONLY occurs when a number in my criteria does NOT have a place holder in the tens column. Specifically, the number 9.00 does not work, but the number 10.00 does work. Does the decimal datatype require a number placeholder in the tens column? Or ??
CAUSES ERROR:
Case
When (Cast(emvalue As varChar(10)) Between 9.00 and 134.99) then '*'
End AS [StarCount]
Does NOT CAUSE ERROR:
Case
When (Cast(emvalue As varChar(10)) Between 10.00 and 134.99) then '*'
End AS [StarCount]
Thanks in advance for any help you can offer.
CAUSES ERROR:
Case
When (Cast(emvalue As varChar(10)) Between 9.00 and 134.99) then '*'
End AS [StarCount]
Does NOT CAUSE ERROR:
Case
When (Cast(emvalue As varChar(10)) Between 10.00 and 134.99) then '*'
End AS [StarCount]
Thanks in advance for any help you can offer.