算术溢出错误!不知道如何解决 --try as decimal(19,3)与字段c一样 update Orders set 字段C= cast(1-(字段A % 字段B) as decimal(19,3)) where ID=7 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 update Orders set 字段C= 1-cast((字段A % 字段B) as numeric(12,2) where ID=7 字段c定义有问题,应该有整数部分,如decimal(10,5),而不应该没有整数部分如decimal(10,10) -->这样看行不行update Orders set 字段C= 1-(字段A*1.0 % 字段B*1.0) where ID=7 alter table alter column C decimal (18,3) alter table Orders alter column C decimal (18,3)update Orders set 字段C= 1-(字段A*1.0 % 字段B*1.0) where ID=7 还是没有解决:比如update Orders set 字段C= cast(1-(40 % 100) as decimal(5,3)) where ID=7得出来的结果是-39 5,3太小了,如果101%102=101,1-101==100,就超出了,你要么干脆用int(你的算法不会有小数部分),或者就用DECIMAL(N,1),N大些,比如DECIMAL(18,1) 问题是再怎么设,上面的结果不对啊,update Orders set 字段C= cast(1-(40 % 100) as decimal(18,3)) where ID=7 我要的答案应该是0.6 或者0.6000而不是-39 晕,你不知道%是取模运算就敢用?如果你要0.6,应该这么写updateupdate Orders set 字段C= 1-(1.0*字段A / 字段B) where ID=7 update Orders set 字段C= cast(1-40*1.0/100 as decimal(18,3)) where ID=7 update Orders set 字段C= cast(1-(字段A / 字段B) as decimal(19,3)) where ID=7 一个面试题,被考住了 咨询一个联合查询的问题 急急急,,在线等.,,.请问使用cursor中是除了select语句是否可以是存储过程 查找表中特殊(异常)的记录-----求一sql语句 sql2000 请高手指点存储过程 请问,UPDATE怎么只修改一条数据,然后跳出? 存储过程??? 有50分等你来拿! 求教一SQL语句,关于distinct与count()的? 请教这样的存储过程该如何写呢? SQL2005的问题?
update Orders set 字段C= 1-(字段A*1.0 % 字段B*1.0) where ID=7
alter table Orders alter column C decimal (18,3)
update Orders set 字段C= 1-(字段A*1.0 % 字段B*1.0) where ID=7
update Orders set 字段C= cast(1-(40 % 100) as decimal(5,3)) where ID=7
得出来的结果是-39
DECIMAL(N,1),N大些,比如DECIMAL(18,1)
update Orders set 字段C= cast(1-(40 % 100) as decimal(18,3)) where ID=7
我要的答案应该是0.6 或者0.6000
而不是-39
update Orders set 字段C= 1-(1.0*字段A / 字段B) where ID=7