第一个算术功能工作
select CreditLimit,'sum'=CreditLimit+Zip from Customers
select CreditLimit,'sub'=CreditLimit-Zip from Customers
select CreditLimit,'div'=CreditLimit/Zip from Customers
最后两个合成功能或不工作显示错误
select CreditLimit,'mod'=CreditLimit%Zip from Customers
ERROR DISPALY: Arithmetic overflow error converting expression to data type smallmoney.
select CreditLimit,'mul'=CreditLimit*Zip from Customers
ERROR DISPALY:The data types smallmoney and nchar are incompatible in the modulo operator.
预先感谢朋友们!
答案 0 :(得分:0)
我怀疑列ZIP
是nchar
数据类型。在执行算术运算之前,您需要将其转换为smallmoney
select CreditLimit,'mod'=CreditLimit%convert(smallmoney,Zip) from Customers