Parameter value '33.42922222' is out of range

asp.net-mvc-3 entity-framework sql-server-2008

Question

I have an attribute of a table named ad Latitude, i have set its data type as decimal(9,8) null but when i try to insert the value 33.42922222 it gives me the error

Parameter value '33.42922222' is out of range.

when i try to directly enter the value in the database table it gives the Arithmetic overflow error

i have tried to change the datatype to numeric(9,8) null but to no avail

please help me find out the problem ...

1
9
8/22/2012 10:34:04 PM

Accepted Answer

For clarification DECIMAL(9,8) is 1 digit before the decimal point and 8 digits after the decimal point.

So DECIMAL(10,8) should work for 33.42922222.

decimal and numeric (Transact-SQL)

17
8/22/2012 10:35:46 PM

Popular Answer

Your precision is not enough. Set precision according to the maximum value which you except. For example, if you expect 999,999 as the maximum value and you need a scale of 8, set it as decimal(14,8).



Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow