我决的写个触发器就可以了
IF EXISTS (SELECT name FROM sysobjects
WHERE name = 'trig_mineAND' type = 'TR')
DROP TRIGGER trig_minecreate trigger trig_mine on 表
for insert,update
as
update 表 set flay=0 where exits(select * from inserted where pubdate=getdate())
IF EXISTS (SELECT name FROM sysobjects
WHERE name = 'trig_mineAND' type = 'TR')
DROP TRIGGER trig_minecreate trigger trig_mine on 表
for insert,update
as
update 表 set flay=0 where exits(select * from inserted where pubdate=getdate())
WHERE name = 'trig_mine' and type = 'TR')
DROP TRIGGER trig_mine
go
create trigger trig_mine on t
for insert,update
as
update t set flag=0 where exists(select * from inserted where cast(pubdate as char(10))=cast(getdate() as char(10))) insert into t
select 'aa1','a122','2004-5-11',1
Set flag =Case When Cast(putdate As Char(10))=Cast(Getdate() As Char(10)) Then 0 Else 1 End
case datediff(day,pubdate,getdate()) when 0 then 0 else 1 end
alter table 你的表 drop column flag
go--再添加上去
alter table 你的表 add flag as case datediff(day,pubdate,getdate()) when 0 then 0 else 1 end