Home All Groups Group Topic Archive Search About

Arithmetic overflow error converting numeric to data type numeric

Author
27 May 2005 3:40 PM
hazz
Column 'Grade' in table is-
numeric length 5
Precision 4
Scale 2

Declare @Grade decimal
Set @Grade = 19.5
Insert into table (Grade)
            Values(@Grade)

Arithmetic overflow error converting numeric to data type numeric.

Do I need an explicit convert for this? Thank you. -hazz

Author
27 May 2005 3:48 PM
Alejandro Mesa
You have to specify precision (default is 18) and scale (default is 0).

> Declare @Grade decimal

declare @grade decimal(4, 2)
....


AMB

Show quoteHide quote
"hazz" wrote:

> Column 'Grade' in table is-
> numeric length 5
> Precision 4
> Scale 2
>
> Declare @Grade decimal
> Set @Grade = 19.5
> Insert into table (Grade)
>             Values(@Grade)
>
> Arithmetic overflow error converting numeric to data type numeric.
>
> Do I need an explicit convert for this? Thank you. -hazz
Are all your drivers up to date? click for free checkup

Author
27 May 2005 3:55 PM
Rick Sawtell
Show quote Hide quote
"hazz" <h***@discussions.microsoft.com> wrote in message
news:6E0DC39F-9339-4B30-AFBC-8749997638B3@microsoft.com...
> Column 'Grade' in table is-
> numeric length 5
> Precision 4
> Scale 2
>
> Declare @Grade decimal
> Set @Grade = 19.5
> Insert into table (Grade)
>             Values(@Grade)
>
> Arithmetic overflow error converting numeric to data type numeric.
>
> Do I need an explicit convert for this? Thank you. -hazz

DECLARE @Grade decimal(4,2)
SET @Grade = 19.5
INSERT TableName(Grade)
VALUES (@Grade)

GO

Bookmark and Share