This error occurred for me when I was trying to catch a decimal type variable at a stored procedure. I fixed this by making what I caught a numeric type variable and then I cast to a decimal like so:
CAST(@Duration AS DECIMAL(4,2))
Another error I bumped into was...
Arithmetic overflow error converting numeric to data type numeric.
...and this error comes when you are trying to shove something beyond a decimal's bounds into a container that can't contain it. My DECIMAL(4,2) column was orginally a DECIMAL(2,2) column meaning that it could have two decimal places but no numbers before the decimal itself. This isn't what I really wanted.
Addendum 3/14/2016: Don't try to cast a numeric to a decimal. The decimal places become zeros. I'm not sure if rounding is involved. Just don't do this. Also, zeros is the pural of zero and zeroes is the verb for zeroing out something.
No comments:
Post a Comment