日期:2014-05-18 浏览次数:20472 次
create trigger tr_t2 on t2 for insert as begin declare @Product_Name varchar(100) select @Product_Name=Product_Name from inserted if @Product_Name is not null if not exists(select 1 from T1 where Product_Name=@Product_Name) insert into T1(Product_Name) select @Product_Name end
------解决方案--------------------
create trigger t2_insert_t1 on t2
for insert
as
begin
declare @Product_Name varchar(100)
select @Product_Name=Product_Name from inserted
if @Product_Name is not null
if not exists(select 1 from T1 where Product_Name=@Product_Name)
insert into T1(Product_Name) select @Product_Name
end
------解决方案--------------------