October 31, 2013 at 12:42 pm
I have a column in a table that is decimal(22,6).
When I try to convert it to decimal(22,8), I get the error
Arithmetic overflow error converting numeric to data type numeric.
I cant see why I get an overflow trying to put a smaller number into a bigger one.
Can anyone explain what im missing?
Note it only happens on certain rows, and I have not identified them yet, but will post when I do.
October 31, 2013 at 1:03 pm
The original definition would hold
1234567890123456.123456
The new definition won't. So if you have a number with greater than 14 positions left of the decimal, you'll get a message. That's the only thing I can think of that would give you the error.
October 31, 2013 at 1:05 pm
You're not putting a smaller number into a bigger one. You should try decimal(24,8).
decimal(22,6) ranges are
-9,999,999,999,999,999.999999 to 9,999,999,999,999,999.999999
decimal(22.8) are
-99,999,999,999,999.99999999 to 99,999,999,999,999.99999999
so they are significantly smaller (100 times).
That's why you need to increase precision if you increase the scale.
November 4, 2013 at 1:58 am
thanks guys. perfect explination. I was incorrectly viewing how decimal/numeric are formatted. Issue resolved.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply