Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 705
  • Last Modified:

Finding the column with Arithmetic overflow error converting expression to data type int.

In the attached code, I am getting the error

Msg 8115, Level 16, State 2, Line 2
Arithmetic overflow error converting expression to data type int.

after getting the values for 20 rows.

are you able to get an idea which column gives the error with the error message?

thanks
spspaceused.txt
0
anushahanna
Asked:
anushahanna
  • 4
  • 3
  • 2
  • +1
4 Solutions
 
dqmqCommented:
Common sense + trial and error.

Focus on int columns that you are making bigger.  Like this one:

      [size_available_bytes] [int]
0
 
anushahannaAuthor Commented:
thanks dqmq. I made all the int's into bigint's; still same issue.
0
 
Patrick MatthewsCommented:
Are you using any function calls that return an int value?  Look for CONVERT, CAST, and DATEDIFF in particular...
0
Build your data science skills into a career

Are you ready to take your data science career to the next step, or break into data science? With Springboard’s Data Science Career Track, you’ll master data science topics, have personalized career guidance, weekly calls with a data science expert, and a job guarantee.

 
anushahannaAuthor Commented:
no, it is a straight insert-select statement. (please remove the - in the select, if you run the query).
0
 
Mohit VijayCommented:
Can you post your SQL Statement here. We can help!
0
 
anushahannaAuthor Commented:
please see attached in the beginning of the post.please remove the - in the select command.
0
 
Mohit VijayCommented:
Run only Select Statement, If it is returning results, check columns, it should be compitable data with your tmp_size table. take extra eye on int and bigint column. It might be possible that your select statement is returning values that is not be convertible in int, bigint.
0
 
dqmqCommented:
May need to comment out half the columns and retry.  Continue to narrow it down that way.  That's what I meant by trial and error.

There's also a remote possibility the error occurs while joining, but I can't see how.
0
 
anushahannaAuthor Commented:
OK. I expanded the numeric columns and also used bigint, so it was probably one of those columns- thanks for the hint and idea.

appreciate you experts.
0
 
Mohit VijayCommented:
Is your problem solved?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

  • 4
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now