"Arithmetic overflow error converting IDENTITY to data type int." error when running a custom business adapter

"Arithmetic overflow error converting IDENTITY to data type int." error when running a custom business adapter

Symptoms:

Customers may see the following error when running a custom business adapter.

20-02-2020 10:17:10 - Debug       - insert into [dbo].[ECMImportLog_Detail] ([ImportID], [ImportObjectID], [RecordNumber], [Action], [RecordDescription], [MGSRecordKey])
                    select 33851,75990, ROWNumber,'Updated',PurchaseOrderNo ,convert(varchar,PurchaseOrder_OutID)  from customCancelledPurchaseOrders where updated=1
20-02-2020 10:17:10 - Error       - Arithmetic overflow error converting IDENTITY to data type int.
Arithmetic overflow occurred.
20-02-2020 10:17:10 - Debug       -    at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async, Int32 timeout, Boolean asyncWrite)
   at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, 

Diagnosis:

The error can happen when the IDENTITY is larger than the maximum value of INT which is 2147483647 when inserting into the log table.

Solution:

Run the following command on the FNMSCompliance database.

DBCC CHECKIDENT('dbo.BusinessImportLogDetail_MT', RESEED, -2147483647)

 

Was this article helpful? Yes No
No ratings
Version history
Revision #:
1 of 1
Last update:
‎Feb 27, 2020 08:22 PM
Updated by:
 
Contributors