高分求一条触发器(在线等)
Student 
       XH(学号)                     XM(姓名)               RXRQ(入学日期)                   
 601226                                                a                                       20040601 
 601227                                                b                                       20040601      
 StuZyB 
    XH(学号)                           ZID(专业号) 
       601226                                             11 
       601227                                             11   
 StuXxxsB 
       XH(学号)                     XXXS(学习形式) 
          601226                                             夜大 
          601227                                             夜大   
 Course 
 ND(入学年度)   ZID(专业号)XXXS(学习形式)   CID(课程号      CName(课程名) 
       2004                                             11                                    夜大                        1111                                    网络   
 Score 
    CID(课程号)            XH(学号)            CJ(成绩)     
 我在Course插入   (2004,11,夜大,1111,网络)的时候, 
 要求能在Score中插入对应的(1111,601226)      (1111,601227),要能在查询分析器中触发的,而不是只有手动录入SQL   SERVER才触发的触发器 
 在Course中(ND、ZID、XXXS、CID)是主键,其中ND、ZID、XXXS能确定班级唯一
------解决方案--------------------create trigger triT 
 on Course 
 for insert 
 as 
 insert score(cid,xh) select cid,xh from StuXxxsB a inner join inserted b on a.xxxs=b.xxxs
------解决方案--------------------create trigger tri_a on Course after insert as 
 if update(CID) 
 insert Score(CID,XH) select A.CID,B.XH  
 from inserted A,Student B,StuZyB C,StuXxxsB D  
 where A.nd=left(B.rxrq,4) and A.zid=C.zid and A.xxxs=D.xxxs  
 and B.xh=C.xh and C.xh=D.xh and B.xh=D.xh
------解决方案--------------------自己解决更好
------解决方案--------------------wgzaaa() ( ) 信誉:100    Blog   加为好友  2007-5-26 0:39:42  得分: 0              
 create trigger tri_a on Course after insert as 
 if update(CID) 
 insert Score(CID,XH) select A.CID,B.XH  
 from inserted A,Student B,StuZyB C,StuXxxsB D  
 where A.nd=left(B.rxrq,4) and A.zid=C.zid and A.xxxs=D.xxxs  
 and B.xh=C.xh and C.xh=D.xh and B.xh=D.xh       
 ------------------------------- 
 这个好像没问题    
------解决方案--------------------CocoPig(可可猪) ( ) 信誉:100    Blog   加为好友  2007-5-26 3:58:27  得分: 0              
 问题已经解决,从现在开始该贴为散分贴