0

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?

4
  • Is that a date, with a typo? Just curious with today being 28-03-20 and all.. Commented Mar 28, 2020 at 5:55
  • No..Its not date :) Commented Mar 28, 2020 at 5:58
  • Can you share the code which inserts the data in table along with sample values? Which type of database it is? Ms SQL or my SQL? Commented Mar 28, 2020 at 5:58
  • Numeric(9,4) can not store 7 digit number coz it can accommodate only number with 5 digit before decimal point and 4 digits after decimal point. stackoverflow.com/questions/60897745/… Commented Mar 28, 2020 at 6:04

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.