I'm trying to insert a number to a column. Column datatype is BIGINT and I'm pretty sure that my number doesn't exceed the max value of BIGINT but still I get
Msg 8115, Level 16, State 2, Line 40
Arithmetic overflow error converting expression to data type int.
The statement has been terminated.
My recent activity was I change the datatype of that column from INT to BIGINT. I think somewhere internally my column is still defined as INT.
Here is my script.
Insert into Customer(Cust_ID)
Select 2150000000
Column Cust_ID datatype is BIGINT in the designer. It is also the PRIMARY_KEY and many table reference it.
EDIT: Here are some of the migration scripts
DROP TABLE dbo.Customer
GO
EXECUTE sp_rename N'dbo.Tmp_Customer', N'Customer', 'OBJECT'
GO
OK I already found the answer. My table has custom constraints which call scalar functions which requires an INT parameter.
Changing all those function's parameter to BIGINT solves the problem.