2

In the past couple of weeks my client's customers have been receiving the error below when running any sort of query on their website. I am not proficient with SQL, so any help would be appreciated.

Stack Trace:

[SqlException (0x80131904): Arithmetic overflow error converting numeric to data type numeric.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +1951066
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +4847051
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +194 System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2392 System.Data.SqlClient.SqlDataReader.HasMoreRows() +157 System.Data.SqlClient.SqlDataReader.ReadInternal(Boolean setTimeout) +197 System.Data.SqlClient.SqlDataReader.Read() +9
System.Data.Common.DataAdapter.FillLoadDataRow(SchemaMapping mapping) +78 System.Data.Common.DataAdapter.FillFromReader(DataSet dataset, DataTable datatable, String srcTable, DataReaderContainer dataReader, Int32 startRecord, Int32 maxRecords, DataColumn parentChapterColumn, Object parentChapterValue) +164
System.Data.Common.DataAdapter.Fill(DataSet dataSet, String srcTable, IDataReader dataReader, Int32 startRecord, Int32 maxRecords) +353
System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +164
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +287
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +92
System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1297 System.Web.UI.WebControls.Repeater.GetData() +35
System.Web.UI.WebControls.Repeater.CreateControlHierarchy(Boolean useDataSource) +220
System.Web.UI.WebControls.Repeater.OnDataBinding(EventArgs e) +51
System.Web.UI.WebControls.Repeater.DataBind() +75
System.Web.UI.WebControls.Repeater.EnsureDataBound() +55
System.Web.UI.WebControls.Repeater.OnPreRender(EventArgs e) +15
System.Web.UI.Control.PreRenderRecursiveInternal() +80
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842

mikerdz
  • 77
  • 1
  • 11
  • See http://stackoverflow.com/questions/2059134/why-sql-server-throws-arithmetic-overflow-error-converting-int-to-data-type-nume . –  May 31 '13 at 17:20

2 Answers2

3

The places to look are either:

  1. There is an update query that is trying to change an int (or some other small number datatype) with a larger number datatype (like a single or a double).
  2. It is trying an isert with the same conditions.

Focus on looking for something changing values with numeric fields and check to see what datatypes are trying to make those changes. When you see a mismatch, that is most likely your culprit.

Ramon
  • 1,016
  • 7
  • 4
0

change sum(col1) to sum(cast(col1 as bigint)) to change the current column's type dynamically or change it in the table design mode.

VahidN
  • 18,457
  • 8
  • 73
  • 117