Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I am having trouble with this query that shows Arithmetic overflow error.

INSERT INTO seed_health_testing_form (seedlotno, modeoftesting, datetested, 
    datecollected, placecollected, sampleno, germination1, germination2, 
    germination3, germination4, germination5, germination6, germination7, 
    germination8, germination9, germination10, remarks) 
VALUES ( 'A00075', 'GTest', '2/14/2013', 
    '2/19/2013', 'Laguna', 0, 50.00, 50.00, 
    50.00, 50.00, 0.00, 0.00, 0.00, 
    0.00, 0.00, 0.00, '')

Table Design

[id]                [int]       IDENTITY(1,1) PRIMARY KEY NOT NULL
[seedlotno]         [varchar](50)   NULL
[modeoftesting]     [varchar](100)  NULL
[datetested]        [datetime]      NULL
[datecollected]     [datetime]      NULL
[placecollected]    [varchar](100)  NULL
[sampleno]          [int]           NULL
[germination1]      [decimal](3, 2) NULL
[germination2]      [decimal](3, 2) NULL
[germination3]      [decimal](3, 2) NULL
[germination4]      [decimal](3, 2) NULL
[germination5]      [decimal](3, 2) NULL
[germination6]      [decimal](3, 2) NULL
[germination7]      [decimal](3, 2) NULL
[germination8]      [decimal](3, 2) NULL
[germination9]      [decimal](3, 2) NULL
[germination10]     [decimal](3, 2) NULL
[remarks]           [varchar](1000) NULL

I tried breaking the INSERT query line by line to trace where the error was but it always point to Line 1. Still I can't find where my problem is.

share|improve this question

1 Answer 1

up vote 5 down vote accepted

All of your [decimal](3, 2) data types are the issue.

The (3,2) tells you that the number can have a precision of 3 digits total, with 2 digits being reserved for the decimal portion.

Thus, you only have 1 digit available to store values like 50, which causes the overflow.

See the decmial datatype documentation for more information.

share|improve this answer
    
I thought (3,2) was 3 whole number and 2 decimal digits. That is why 1.00 doesn't give me error. Thanks –  pvzkch Feb 26 '13 at 18:09

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.