日期:2014-05-17 浏览次数:20562 次
IF exists (select 1 from sysobjects where type='P' and name like N'proc_A' ) drop procedure 'proc_A' go create proc proc_A @nowdate datetime as update A set 滞纳金天数=case when @nowdate>滞纳金截止日期 then datediff(day,滞纳金截止日期,@nowdate) else 0 end ,滞纳金额=(isnull(滞纳天数,0)*费用额*0.005) from A where 标志=a go
------解决方案--------------------
IF exists (select 1 from sysobjects where type='P' and name like N'proc_A' ) drop procedure 'proc_A' go create proc proc_A @nowdate datetime as update A set 滞纳金天数=case when @nowdate>滞纳金截止日期 then datediff(day,滞纳金截止日期,@nowdate) else 0 end ,滞纳金额=(isnull(滞纳天数,0)*费用额*0.005) from A where 标志=a go
------解决方案--------------------
IF exists (select 1 from sysobjects where type='P' and name like N'proc_A' ) drop procedure 'proc_A' go create proc proc_A @nowdate datetime as update A set 滞纳金天数=case when @nowdate>滞纳金截止日期 then datediff(day,滞纳金截止日期,@nowdate) else 0 end ,滞纳金额=(isnull(滞纳天数,0)*费用额*0.005) from A where 标志=a go
------解决方案--------------------
我的回复也到哪去了? 无语。。。
-->sql语句供参考,存储自己写 select 编码,滞纳金截止日期, case when datediff(dd,滞纳金截止日期,getdate())>0 and 标志=a then datediff(dd,滞纳金截止日期,getdate()) else 0 end 滞纳天数, case when datediff(dd,滞纳金截止日期,getdate())>0 and 标志=a then cast(datediff(dd,滞纳金截止日期,getdate()) as money)*0.05*费用额 else 0 end 滞纳金额 from 表A