Thursday, August 12, 2021

Arithmetic overflow error converting expression to data type int Error(Msg 8115) in SQL Server

SQL Error:-Arithmetic overflow error converting expression to data type int Error(Msg 8115) in SQL Server

SQL Error No:-Msg 8115

To recreate this issue, I have created a test table testOverflow.

create table testOverflow(

column1 int,

column2 int)


=> To test if the normal insert works, I am inserting some random numbers into the table. and the insert is successful


Insert into testOverflow values(1111111,2222222)


=> Now I am increasing the length of column2 values as shown in the below query,

Insert into test11 values(1111111,22222222222)


and with this, overflow error occurs.

Error message:

Msg 8115, Level 16, State 2, Line 9

Arithmetic overflow error converting expression to data type int.

The statement has been terminated.


=> For this solution would be either change the datatype of column2 to hold a larger value.
Ex:Change Int to BigInt or change the value of the column to a smaller value to hold within Int limits



Top 15 SQL interview questions for 2-5 years experienced

  1. What is the difference between UNION and UNION ALL? UNION: To select related information from two tables UNION command is used. It is s...