问个触发器的写法,
公司让小弟写个触发器,但是小弟我没学过,只好问各位大哥了, 
 check   器具表							   
 check_id 
 check   _name 
 check   _code 
 check_time 
 producer 
 purpose 
 NAME1, 
 NAME2,   
 corp   企业表	 
 corp_id 
 corp_code 
 corp_name 
 corp_addr 
 corp_telephone 
 NAME1, 
 NAME2,   
 product产品表 
 product_id 
 check   _name 
 check   _code 
 check_time 
 producer 
 purpose 
 corp_code 
 corp_name 
 corp_addr 
 corp_telephone   
 就是有个产品先存入产品表,然后根据产品表的信息存入相应的企业表和器具表.如果产品表中corp_code在企业表中有就只存入产品表,还有个就是器具表的时间也就是存入的时间   
 小弟触发器一点都不会,希望各位大大不要笑话,
------解决方案--------------------CREATE TRIGGER trig1 on 产品表 FOR INSERT 
 AS  
   insert into 企业表(字段a1,字段a2....) select 字段a1,字段a2.... from 产品表 
   insert into 器具表(字段b1,字段b2....) select 字段b1,字段b2.... from 产品表 
 GO
------解决方案--------------------create trigger tri_insert on product产品表 
 after insert 
 as 
 --插入corp 企业表 
 if not exists(select 1 from corp 企业表 where corp_code in(select corp_code from inserted)) 
 begin 
 insert into corp 企业表(corp_code,corp_name,corp_addr,corp_telephone) 
 select corp_code,corp_name,corp_addr,corp_telephone from inserted 
 end   
 --插入check 器具表	 
 insert into [check] 器具表(check_id,check _name,check _code,check_time,producer,purpose) 
 select product_id,check _name,check _code,check_time,producer,purpose from inserted     
------解决方案--------------------create trigger tr_test 
 on product 
 for insert 
 as 
 set nocount on 
 insert corp(/*字段列表*/) select /*字段列表*/ from INSTERED where crop_code in (select corp_code from corp) 
 insert check(/*字段列表*/) select /*字段列表*/, check_time=getdate() from INSTERED 
 set nocount off 
 go
------解决方案--------------------CREATE TRIGGER trig1 on 产品表 FOR INSERT 
 AS  
   insert into 企业表(字段a1,字段a2....) select 字段a1,字段a2.... from inserted 
   insert into 器具表(字段b1,字段b2....) select 字段b1,字段b2.... from inserted 
 GO 
------解决方案--------------------改一下: 
 create trigger trigTest  
 on 产品表 
 for insert 
 as 
 insert 企业表(Filed....) select Filed... from inserted where corp_code not in(select corp_code from 企业表)   
 insert 器具表(Filed...) select Filed....from inserted