BEGIN TRAN
INSERT INTO 表1 ....
INSERT INTO 表2 (id,...) VALUE ((SELECT MAX(ID) FROM 表1),...)
COMMIT TRAN

解决方案 »

  1.   

    to xl():
    能否给出具体的SP,多谢!
      

  2.   

    使用游标,在循环中使用:1.  insert into table1 ..........2.  insert into table2(id) 
        select id from table1 where id=(select max(id) from table1) 
      

  3.   

    create trigger on t1 for insert
    as
    begin
       insert into t2(id) select id from inserted
    end
      

  4.   

    就用触发器进行保证,很EASE的