Sql 获取错误原因:将数字转换为数据类型numeric时出现算术溢出错误
之后Sql 获取错误原因:将数字转换为数据类型numeric时出现算术溢出错误,sql,sql-server,sql-server-2008,sql-server-2005,Sql,Sql Server,Sql Server 2008,Sql Server 2005,之后 SELECT TradeId, Trade_SecurityId, SecurityType.*, Trade_ParAmount Quantity INTO #Securities FROM Fireball.dbo.PreAssignSecurityType SecurityType INNER JOIN Fireball_RawImportData.dbo.Import_WSO_TradeReport TradeR
SELECT
TradeId,
Trade_SecurityId,
SecurityType.*,
Trade_ParAmount Quantity
INTO
#Securities
FROM
Fireball.dbo.PreAssignSecurityType SecurityType
INNER JOIN
Fireball_RawImportData.dbo.Import_WSO_TradeReport TradeReport ON
SecurityType.NativeTradeId = TradeReport.Trade_ID AND
TradeReport.Trade_TradeDate = SecurityType.TradeDate
INNER JOIN
Fireball..Trade ON
Trade.NativeTradeId = SecurityType.NativeTradeID
WHERE
SecurityType.TradeDate = '2012-02-02'
表定义:
INSERT INTO
Fireball..IRPTrade
(TradeId, Par, TradeFee, AccruedInterest, AccruedPIK, AccruedFees)
SELECT
TradeId,
Par,
TradeFee,
AccruedInterest,
AccruedPIK,
AccruedFees
FROM
Fireball..bondTrade
WHERE
TradeId IN
(
SELECT
TradeId
FROM
#Securities
WHERE
SecurityType = 'IRP' OR
SecurityType = 'IRS'
) AND
NOT EXISTS(
SELECT *
FROM -- GETTING ERROR AT THIS LINE WHY :(
Fireball..IRPTrade
WHERE
TradeId = bondTrade.TradeId)
可能是从表
Fireball..IRPTrade
,Fireball..bondTrade
?中获取的列值之一。如果没有表的定义,很难回答:)
根据错误消息,很可能是在插入过程中引发的错误,因为VARCHAR列中的数据无法正确转换为INT列。上次我收到类似错误是因为数字字段中的一个值被设置为NaN,而不是数字,更正了值或删除了行,之后一切正常。算术溢出错误将数字转换为数据类型numeric能否在错误附近的表格中发布列的数据类型?或者发布每个表的表def?好的,我将更新其他coulmn是否为十进制(32,4)可能是获取的值超过了获取错误的bcoz?@Siva我已经用数据类型更新了我的问题,请帮助我。
BondTradeId int Unchecked
TradeId int Unchecked
Par decimal(32, 4) Checked
TradeFee decimal(32, 4) Checked
AccruedInterest decimal(32, 4) Checked
AccruedPIK decimal(32, 4) Checked
AccruedFees decimal(32, 4) Checked
Unchecked
IRPTradeId int Unchecked
TradeId int Unchecked
Par decimal(32, 4) Checked
TradeFee decimal(32, 4) Checked
AccruedInterest decimal(32, 4) Checked
AccruedPIK decimal(32, 4) Checked
AccruedFees decimal(32, 4) Checked
Unchecked