2

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.

1 Answer 1

7

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.

Sign up to request clarification or add additional context in comments.

1 Comment

I thought (3,2) was 3 whole number and 2 decimal digits. That is why 1.00 doesn't give me error. Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.