只要获取到值,就可以插入
insert S([id],code) values(1,100)
insert H([id],code) values(1,100)
要使两条语句同时执行,而且出现问题的时候,回滚数据不出现只回滚一条的情况,最好是将两条插入或更新语句写在同一个事务里面
创建触发器
create trigger insert_H on S for insert
as
declare @new_id real,@new_time real
begin
select @new_id=id,@code=code from inserted
insert into b values(@new_id,@new_code)
end
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO