zoukankan      html  css  js  c++  java
  • 触发器小练

    ALTER Trigger [dbo].[triVehicle] On [dbo].[OP_VehicleInfo]
    for insert
    As
    DECLARE @order int;
    DECLARE @outorder int;
    set @order = (select max(InSideSort)+1 from OP_VechileState) ;
    set @outorder = (select max(OutsideSort)+1 from OP_VechileState) ;
    INSERT into OP_VechileState select inserted.vehicleid,@order ,@outorder,'1',null from inserted

    、、、、、

    ALTER Trigger [dbo].[trdVehicle] On [dbo].[OP_VehicleInfo]
    for Delete
    As
    Delete dbo.OP_VechileState From dbo.OP_VechileState br , deleted d Where br.VehicleID=d.VehicleID
    Delete dbo.OP_Clean From dbo.OP_Clean br , deleted d Where br.VehicleID=d.VehicleID
    Delete dbo.OP_DutyInfo From dbo.OP_DutyInfo br , deleted d Where br.VehicleID=d.VehicleID
    Delete dbo.OP_Vacation From dbo.OP_Vacation br , deleted d Where br.VehicleID=d.VehicleID
    Delete dbo.OP_Maintain From dbo.OP_Maintain br , deleted d Where br.VehicleID=d.VehicleID
    Delete dbo.OP_VehicleBusinessInner From dbo.OP_VehicleBusinessInner br , deleted d Where br.VehicleID=d.VehicleID
    Delete dbo.OP_VehicleBusinessOuter From dbo.OP_VehicleBusinessOuter br , deleted d Where br.VehicleID=d.VehicleID

    、、、、、

    ALTER Trigger [dbo].[triVehiclestate] On [dbo].[OP_VechileState]
    for update
    As
    if update([state])
    begin
    update OP_VechileState set preState =d.state from OP_VechileState vs , deleted d where vs.VehicleId = d.VehicleId
    end

  • 相关阅读:
    zombodb 数据类型映射
    Amundsen — Lyft’s data discovery & metadata engine
    The Twelve-Factor Container
    zombodb sql functions 说明
    zombodb 得分以及高光
    windows openssh 设置root 目录
    zombodb 聚合函数
    zombodb 索引管理
    zombodb 索引创建
    zombodb 低级api 操作
  • 原文地址:https://www.cnblogs.com/sijiyong/p/3518624.html
Copyright © 2011-2022 走看看