日期:2014-05-18 浏览次数:20566 次
create table 表a(
a datetime,
b int)
insert 表a values('1988-01-02',0)
update 表a set b=1 where a<getdate()
select * from 表a
drop table 表a
/*
a b
------------------------------------------------------ -----------
1988-01-02 00:00:00.000 1
(所影响的行数为 1 行)
*/
------解决方案--------------------
update a表 set b=1 where datediff(day,a,getdate())>0
------解决方案--------------------
作业,触发器更新
------解决方案--------------------
update 表a set b=1 where a <getdate()