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
本文转自左正博客园博客,原文链接:http://www.cnblogs.com/soundcode/p/6210866.html,如需转载请自行联系原作者