July 10, 2009 at 5:37 am
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
July 10, 2009 at 5:58 am
Decimal(5,5) means a number that has 5 digits in total and 5 on the right hand side of the decimal place. Hence it cannot allow any number larger than .99999 because it has no digits left for the left hand side of the decimal point
To allow a value of 1.0, the precision has to be at least 1 higher than the scale. Precision (the first number specified) is the total number of digits allowed. Scale (the second number specified) is the number of digits allowed on the right hand side of the decimal point.
Check Books Online for more details on specifying decimal and numeric types.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
July 10, 2009 at 9:15 am
hi Gail ,
Thanks a lot for informing , i got the what problem exactly
i change that (10,5) and now its working fine
Thanks
Vikram
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply