我遇到以下SIMPLE查询时遇到问题:
INSERT INTO table (
[Date],
[Name],
[Weight],
[Position],
[Effective_Maturity],
[Yield_to_Worst],
[Modified_Duration],
[OAD],
[CTD],
[OAC],
[OAS],
[Coupon],
[Credit_Rating],
[CUSIP],
[Market_Value],
[Principal],
[Yield_to_Maturity])
VALUES
('6/28/2013','ISHARES BARCLAYS TIPS BOND FUND','100','0','8.647','0.0772','0.0772','3.8629','8.204','8.2040','1.112','9.034','1.543','AAA','TIPETF','1796461','178696')
GO
我不确定我的表中的哪个变量无法转换为数字,而且我对MS SQL中的数据类型的了解也很缺乏。但是,我认为大多数这些输入正确适合各自的数据类型。表数据类型为:
谢谢!
答案 0 :(得分:5)
您尝试将“TIPETF”字符串放在[Market_Value]列中,该列是数字。
答案 1 :(得分:4)
您的字段排列不正确:'AAA'
看起来像信用评级,而不是CUSIP(CUSIPs are nine characters long)。
看起来你跳过了一个值,或者在中间的某处添加了一个字段,或者两者都是:
[Date] = '6/28/2013',
[Name] = 'ISHARES BARCLAYS TIPS BOND FUND'
[Weight] = '100',
[Position] = '0',
[Effective_Maturity] = '8.647',
[Yield_to_Worst] = '0.0772',
[Modified_Duration] = '0.0772',
[OAD] = '3.8629',
[CTD] = '8.204',
[OAC] = '8.2040',
[OAS] = '1.112',
[Coupon] = '9.034',
[Credit_Rating] = '1.543',
[CUSIP] = 'AAA', -- <<<=== THIS IS NOT A VALID CUSIP
[Market_Value] = 'TIPETF',
[Principal] = '1796461',
[Yield_to_Maturity] = '178696'
要解决此问题,请确保列名称与您插入的值“对齐”。