Reputation: 1202
I have a DB column with Decimal(9,2) data type and using EF to update the column. I am getting a parameter value out of range exception when I am trying to add 10212984. I am not sure why it's not letting it get added because it seems to be in range of the decimal storage value. Can someone please have a look and let me know what I am missing here.
Thanks
Upvotes: 0
Views: 752
Reputation: 1500515
It's not in the range of a Decimal(9, 2)
The precision there is 9, meaning 9 decimal digits in total, and the scale of 2 means that 2 of the digits go after the decimal point, and 7 go before the decimal point.
So a field of type Decimal(9, 2)
has valid values in the range -9,999,999.99 to 9,999,999.99. Your value is outside that range - it requires 8 digits before the decimal point.
Upvotes: 4