How to correct Arithmetic overflow error converting nvarchar to numeric for sql datatype numeric(9, 4)?

1.4k Views Asked by At

I have the value as 2800320 which I need to insert to table for numeric(9, 4) datatype. In the code I have given as float.Parse(record.Substring(i, 8)).When I insert to sql arithmetic overflow error occurs. Pls tell how to correct this?

1

There are 1 best solutions below

0
On

NUMERIC(9,4) means "a number with 9 digits in total, 4 of which are after a decimal point" meaning you have 5 digits left over to store your 7 digit number 2800320

Clearly, this isn't going to work. Pick a bigger numeric, or divide your number by 100 or more so it will fit