Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Decimal out of range

I'm trying to store the decimal 140.2705893427 into a SQL Server 2012 table. The column has a data type of decimal(12, 10) but I get the error:

{"Parameter value '140.2705893427' is out of range."}

Why is this?

like image 815
Sachin Kainth Avatar asked Sep 18 '13 14:09

Sachin Kainth


People also ask

How do you fix a column out of range value?

To fix the error, change your datatype to VARCHAR . Phone and Fax numbers should be stored as strings.

What is the range of decimal in MySQL?

The precision represents the number of significant digits that are stored for values, and the scale represents the number of digits that can be stored following the decimal point. This would allow for a range of -9,999,999,999,999.99 to -9,999,999,999,999.99.

How to fix error 1264 MySQL?

To fix the issue, we will have to store a less than 2147483647 or change the data type of student_ssn_no to BIGINT. Let us modify the column to BIGINT and try inserting the data again.

What is Out of range value in MySQL?

When MySQL stores a value in a numeric column that is outside the permissible range of the column data type, the result depends on the SQL mode in effect at the time: If strict SQL mode is enabled, MySQL rejects the out-of-range value with an error, and the insert fails, in accordance with the SQL standard.


1 Answers

decimal(12, 10) means 12 total digits, 10 of which may be after the decimal point.

Your value of 140.2705893427 has 13 total digits, thus it is out of range.

Read decimal and numeric (Transact-SQL) for documentation.

like image 166
Karl Anderson Avatar answered Oct 11 '22 16:10

Karl Anderson