断今天日期和指定日期相等和两者的时间差为两年的sql

1.  ---判断今天日期和指定日期相等 
update store  set Status =1 where CONVERT(varchar(12) ,opendate, 105 )= CONVERT(varchar(12) , getdate(), 105 ) and  Status=0; 

---判断两者的时间差为两年 
update customer set enable=0 where  DATEDIFF(d, s.LastOrderDate,getdate() )>=730 

select * from customer as s where  DATEDIFF(d, s.LastOrderDate,getdate() )>=730

posted @ 2016-12-22 13:33  左正  阅读(1481)  评论(0编辑  收藏  举报