Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Arithmetic overflow error converting numeric to da

Author  Topic 

vikramsinh
Starting Member

4 Posts

Posted - 2009-07-10 : 07:36:26
Hi all
I have below table

CREATE TABLE [dbo].[Name](
[Name] [nchar](10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[decimal] [decimal](5, 5) NULL
) ON [PRIMARY]

I am trying to insert following values in the table

INSERT INTO [test].[dbo].[Name]
([Name]
,[decimal])
VALUES
('test'
, 1.0)
But it’s give the following error
Arithmetic overflow error converting numeric to data type numeric.

Thanks
Vikram patil

karthik_padbanaban
Constraint Violating Yak Guru

263 Posts

Posted - 2009-07-10 : 07:55:30
CREATE TABLE [dbo].[Name](
[Name] [nchar](10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[decimal] [decimal](5, 5) NULL
) ON [PRIMARY]

you have mentioned decimal(5,5) so you can insert data like 0.12345,

make it to [decimal](10, 5) this will allow you like 12345.12345

chenge this as per your requirement.

Karthik
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-07-10 : 11:27:02
quote:
Originally posted by karthik_padbanaban

CREATE TABLE [dbo].[Name](
[Name] [nchar](10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[decimal] [decimal](5, 5) NULL
) ON [PRIMARY]

you have mentioned decimal(5,5) so you can insert data like 0.12345,

make it to [decimal](10, 5) this will allow you like 12345.12345

chenge this as per your requirement.

Karthik


decimal (p,s) means p represents total number of digits and s represents number of digits after decimal point. so (5,5) means you've giving all 5 digits to decimal part so it will fail when you pass even a single digit before decimal point.
Go to Top of Page
   

- Advertisement -