• 要用的触发器


    IF OBJECT_ID ('ppSDetail_PPIn','TR') IS NOT NULL
    DROP TRIGGER ppSDetail_PPIn;
    GO

    CREATE TRIGGER ppSDetail_PPIn ON ppSDetail
    AFTER INSERT
    AS
    DECLARE @iBillType INTEGER
    DECLARE @cBillCode VARCHAR(100)


    SELECT @iBillType=iBillType,@cBillCode=cBillCode FROM Inserted

    IF @iBillType = 0
    BEGIN
    IF EXISTS(SELECT 1 FROM
    ppSDetail a
    LEFT JOIN
    PPInDetailPlace b
    ON b.cbillcode=a.cBillCode
    AND a.cPaperCode=b.cpapercode
    WHERE a.cBillCode=@cBillCode AND b.cpapercode IS NULL)
    BEGIN
    RAISERROR ('触发器:确认入库时出现入库单(" + @cBillCode + ")不存在的纸写入了实物账中的问题,请找系统管理员报告这个错误!', 16, 1);
    ROLLBACK TRANSACTION;
    RETURN
    END
    END

  • 相关阅读:
    文件操作3
    文件操作2
    kubernetes快速应用入门
    kubeadm初始化kubernetes集群
    kubernetes基础概念
    变量
    字面值
    关键字
    标识符
    Ubuntu安装MySql5.7
  • 原文地址:https://www.cnblogs.com/zhangzhifeng/p/5076627.html
Copyright © 2020-2023  润新知