2019-02-25 SQL:cast(itemvalue as decimal(19,4))
1.Operand data type nvarchar(max) is invalid for sum operator
要转换格式
2.Conversion failed when converting the nvarchar value '236850.00' to data type int.
不能转换int,用decimal(19,4),19位整数,4位小数
3.Error converting data type varchar to numericm
遇到非字符串的要跳过,如19亿
4.字符串前面加N,否则报错
5.正确操作
select SUM(cast(itemvalue as decimal(19,4))) from [TrustManagement].[TrustBond] where ItemCode=N'OfferAmount' and ISNUMERIC(ItemValue)=1