0
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)

表定义:

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

可能是decimal(32,4)从表中获取超过的列值之一Fireball..IRPTradeFireball..bondTrade

4

2 回答 2

1

如果没有表的定义,很难回答 :) 根据错误消息,很可能是在 INSERT 期间引发的错误,因为来自 VARCHAR 列的数据无法正确转换为 INT 列。

于 2012-05-09T14:46:31.823 回答
1

上次我遇到类似的错误是因为数字字段中的一个值设置为 NaN,而不是数字,更正了值或删除了行,之后就很好了。

于 2012-05-10T02:47:27.087 回答