日期:2014-05-18 浏览次数:20420 次
declare @input as decimal(10,2) declare @temp as decimal(10,2) declare @temp1 as int set @input=1.89 select @temp=(@input-cast(@input as int)),@temp1=cast(@input as int) if @temp>0.60 begin set @temp=@temp-0.60 set @temp1=@temp1+1 end else begin set @temp=0 set @temp1=@temp1+1 end select @temp1+@temp
------解决方案--------------------
declare @n decimal(5,2)
set @n=12.61
select case when right(CONVERT(varchar(8), @n),2)>='6' then @n+0.4 else @n end
---------------------------------------
13.01
(1 行受影响)
------解决方案--------------------
declare @d dec(18,2) set @d=1.89 select case when @d*100%100>=60 then @d+0.4 else @d end