日期:2014-05-18  浏览次数:20585 次

求一触发器,虽仅有20分,是吾全部的家当。望高手不吝赐教,在此拜谢。
表   :A
  字段:
id     name     time
1       a           2006-04-26   7:22:53
2       b           2006-04-26   8:12:53
3       c           2006-04-26   9:10:53
4       d           2006-04-26   10:8:53
5       e           2006-04-26   11:47:53


假如   我登陆后   sql   根据我当前的登陆时间判断,如果时间是在8点之前,给予提示,或拒绝登陆。如果是在8点后   可以让其登陆。


------解决方案--------------------
触发器无法捕获登陆事件.


------解决方案--------------------
create trigger tu_A on A
for update
as
if update(name) and exists(select 1 from inserted i,deleted where i.id=d.id and isnull(i.name, ' ') <> isnull(d.name, ' '))
begin
update B
set name=i.name
from B,inserted i,deleted d
where B.num=i.sign and i.id=d.id and isnull(i.name, ' ') <> isnull(d.name, ' ')
end