触摸屏租赁
Touch screen rental
广告机租赁
Advertising rental
机器人租赁
Robot leasing
 当前位置:首页 > > 触发器(删除和更新)

触发器(删除)
    Create trigger trdemployee
       On employee
       for Delete
     As
       Delete daily
         From daily br , Deleted d
         Where br.username=d.username

触发器(更新)
     Create Trigger truemployee
       On employee                         --在employee表中创建触发器
       for Update                          --为什么事件触发
     As                                        --事件触发后所要做的事情
       if Update(name)           
       begin

         Update daily
           Set name=i.name
           From daily br , Deleted   d ,Inserted i      --Deleted和Inserted临时表
           Where br.username=d.username
       end       

触发器(一表更新多表)
     Create Trigger trudept_type
       On dept_type                         --在employee表中创建触发器
       for Update                          --为什么事件触发
     As                                        --事件触发后所要做的事情
       if Update(type)           
       begin
         Update daily
           Set dept=i.type
           From daily br , Deleted   d ,Inserted i      --Deleted和Inserted临时表
           Where br.dept=d.type

         Update employee
           Set dept=i.type
           From employee br , Deleted   d ,Inserted i      --Deleted和Inserted临时表
           Where br.dept=d.type
       end


工作室地址:重庆石桥铺电脑城B座 | 微信:z35544216 | 网址:www.35544216.com