Click here to Skip to main content
15,891,012 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am getting an error on using int datatype on inserting values.

create table Product(
Id_Product nvarchar(10) primary key,
Product_Name nvarchar(30),
Measuring_Unit nvarchar(10),
Unit_Price decimal(3,2),
Quantity int)

insert into Product values ('PROD0001','Red Bull','250g',10.00,5)

The Error Message:

Msg 8115, Level 16, State 8, Line 1
Arithmetic overflow error converting numeric to data type numeric.
The statement has been terminated.
Posted
Updated 17-Aug-13 22:23pm
v2

1 solution

Look at your table definition. It's not the Integer thats the problem, it's the Decimal: (3,2) means that values up to 9.99 are valid, 10.00 is not...

[edit]Tablet auto correct... grrrr![/edit]
 
Share this answer
 
v2
Comments
Sunil Pavithran Nair 18-Aug-13 4:52am    
sir so i have to change the table definition as (5,2) correct???
OriginalGriff 18-Aug-13 5:29am    
If you want 999.99 to be valid, yes.
The first digit specifies the number of digits in total, the second the number to the right of the decimal point.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900