简体   繁体   English

将数值转换为数值类型的算术溢出错误

[英]Arithmetic overflow error converting numeric to data type numeric

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. 我不精通SQL,因此不胜感激。

Stack Trace: 堆栈跟踪:

[SqlException (0x80131904): Arithmetic overflow error converting numeric to data type numeric.] [SqlException(0x80131904):将数字转换为数据类型数字的算术溢出错误。
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +1951066 System.Data.SqlClient.SqlConnection.OnError(SqlException异常,布尔值breakConnection)+1951066
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +4847051 System.Data.SqlClient.SqlInternalConnection.OnError(SqlException异常,布尔值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.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)+194 System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior,SqlCommand cmdHandler,SqlDataReader dataStream,BulkCopySimpleResultSet bulkCopyHandler,TdsParserStateClientStateData2Data。 HasMoreRows()+157 System.Data.SqlClient.SqlDataReader.ReadInternal(布尔值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.FillLoadDataRow(SchemaMapping映射)+78 System.Data.Common.DataAdapter.FillFromReader(DataSet数据集,DataTable数据表,字符串srcTable,DataReaderContainer数据阅读器,Int32 startRecord,Int32 maxRecords,DataColumn parentChapterColumn,对象parentChapterValue)+ 164
System.Data.Common.DataAdapter.Fill(DataSet dataSet, String srcTable, IDataReader dataReader, Int32 startRecord, Int32 maxRecords) +353 System.Data.Common.DataAdapter.Fill(数据集dataSet,字符串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.FillInternal(DataSet数据集,DataTable []数据表,Int32 startRecord,Int32 maxRecords,字符串srcTable,IDbCommand命令,CommandBehavior行为)+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,Int32 startRecord,Int32 maxRecords,字符串srcTable,IDbCommand命令,CommandBehavior行为)+287
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +92 System.Data.Common.DbDataAdapter.Fill(数据集dataSet,字符串srcTable)+92
System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1297 System.Web.UI.WebControls.Repeater.GetData() +35 System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments参数)+1297 System.Web.UI.WebControls.Repeater.GetData()+35
System.Web.UI.WebControls.Repeater.CreateControlHierarchy(Boolean useDataSource) +220 System.Web.UI.WebControls.Repeater.CreateControlHierarchy(布尔useDataSource)+220
System.Web.UI.WebControls.Repeater.OnDataBinding(EventArgs e) +51 System.Web.UI.WebControls.Repeater.OnDataBinding(EventArgs e)+51
System.Web.UI.WebControls.Repeater.DataBind() +75 System.Web.UI.WebControls.Repeater.DataBind()+75
System.Web.UI.WebControls.Repeater.EnsureDataBound() +55 System.Web.UI.WebControls.Repeater.EnsureDataBound()+55
System.Web.UI.WebControls.Repeater.OnPreRender(EventArgs e) +15 System.Web.UI.WebControls.Repeater.OnPreRender(EventArgs e)+15
System.Web.UI.Control.PreRenderRecursiveInternal() +80 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.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 System.Web.UI.Page.ProcessRequestMain(布尔includeStagesBeforeAsyncPoint,布尔includeStagesAfterAsyncPoint)+842

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). 有一个更新查询试图更改具有较大数字数据类型(例如单或双)的int(或其他一些较小数字数据类型)。
  2. It is trying an isert with the same conditions. 它正在尝试使用相同条件的isert。

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. 当您看到不匹配时,很可能是您的罪魁祸首。

sum(col1)更改为sum(cast(col1 as bigint))即可动态更改当前列的类型,或在表设计模式下进行更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误:将数字转换为数据类型数字的算术溢出错误 - Error: Arithmetic overflow error converting numeric to data type numeric 在执行查询时将数值转换为数值类型的算术溢出错误 - Arithmetic overflow error converting numeric to data type numeric on query execution 在插入时将数字转换为数据类型数字的算术溢出错误 - Arithmetic overflow error converting numeric to data type numeric on insert 将数字转换为数据类型数字的算术溢出错误 - Arithmetic overflow error converting numeric to data type numeric SQL 8115将数值转换为数据类型numeric的算术溢出错误 - SQL 8115 Arithmetic overflow error converting numeric to data type numeric 将数字转换为数据类型数字的算术溢出错误 - Arithmetic overflow error converting numeric to data type numeric 将数值转换为数值类型的算术溢出错误 - Arithmetic overflow error converting numeric to data type numeric 算术溢出错误将数字转换为数据类型数字 - Arithmetic overflow error converting numeric to data type numeric 算术溢出错误将varchar转换为数据类型numeric -error - Arithmetic overflow error converting varchar to data type numeric -error 错误:将数字转换为数据类型varchar的算术溢出错误 - Error : Arithmetic overflow error converting numeric to data type varchar
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM