在A表更新了以后,B表的前两列会自动更新,将A表的新记录添加到B表中。
表A有两列  
ID                              date  
----------------------------------  
0001                        2005-11-11  
0006                        2005-10-20  
0003                        2005-03-03  
 
 
表B有5列  
ID                              date1                               date2      
--------------------------------------------  

解决方案 »

  1.   

    1.sql 触发器
    2.开事务,处理两个表,提交事务,出错回滚事务
      

  2.   

    自己看看吧,应该能明白,把触发器的内容改成你的
    ---创建表
    create table t(id int primary key ,a int, b int)
    go
    --插入数据
    insert into t select 1,2,3
    union select 2,3,4
    go
    create view v_t
    as
     select * from t
    go
    select * from v_t
    go
    --创建视图触发器
    create TRIGGER tr_v_t ON v_t
    instead of update
    as
    begin
      if (select id from inserted where id =1)>0 
      update v_t set a=a+1 where id=2
    end
    go
    update v_t set a= 8 where id=1
    select * from v_t
    go
    drop trigger tr_v_t
    drop table t
    drop view v_t
    go
      

  3.   

    insert into tablea(id,date) select id,date1 from tableb where id not in (select id from tableB);
    自己搞出来个插入的,但不知道删除和更新的怎么写。