Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why can't I insert a decimal into an sql server table?

Tags:

sql

sql-server

I have a simple query:

INSERT INTO tblIndicators (RunID, EventTS, MA1t3) 
Values (65, '11/2/2012 2:25:00 AM', 1.0); 

I get this error message:

Msg 8115, Level 16, State 8, Line 1
Arithmetic overflow error converting numeric to data type numeric.

The precision on the Decimal datatype is (8,8). So whats the problem??

like image 387
user1871040 Avatar asked Dec 02 '12 21:12

user1871040


People also ask

How do I allow decimals in SQL?

In standard SQL, the syntax DECIMAL( M ) is equivalent to DECIMAL( M ,0) . Similarly, the syntax DECIMAL is equivalent to DECIMAL( M ,0) , where the implementation is permitted to decide the value of M . MySQL supports both of these variant forms of DECIMAL syntax. The default value of M is 10.

Is decimal a valid datatype in SQL?

DECIMAL [(p[,s])] or DEC [(p[,s])]The DECIMAL data type accepts numeric values, for which you may define a precision and a scale in the data type declaration. The precision is a positive integer that indicates the number of digits that the number will contain.


1 Answers

decimal (8, 8) means all 8 of your significant digits are to the right of the decimal point. 1.0 is too big.

like image 116
Laurence Avatar answered Dec 19 '22 23:12

Laurence