首页 新闻 会员 周边 捐助

SQL触发器:下面这段代码的意思是?

0
[已关闭问题] 关闭于 2016-09-07 23:59
IF EXISTS (SELECT 1 FROM INSERTED t1 INNER JOIN DELETED t2 ON t1.ID = t2.ID AND t1.FlagColumn = 10 AND t2.FlagColumn = 5)
    BEGIN
        UPDATE t1 SET t1.FlagColumn = 3,t1.完成人=t2.完成人,t1.完成时间=t2.完成时间
        FROM TDZ_订单表_订单内容 t1
        INNER JOIN INSERTED t2 ON t1.流水号 = t2.流水号 and t1.Flagcolumn <> 3
    END

    IF EXISTS (SELECT 1 FROM INSERTED t1 INNER JOIN DELETED t2 ON t1.ID = t2.ID AND t1.FlagColumn = 5 AND t2.FlagColumn = 0)
    BEGIN
        
        if exists( SELECT 1 FROM TDZ_订单表 t1 INNER JOIN INSERTED t2 ON t1.ID = t2.ID AND (t1.审核人 is null or t1.审核人 = ''))
        
        UPDATE t1 SET t1.FlagColumn = 2
        FROM TDZ_订单表 t1
        INNER JOIN INSERTED t2 ON t1.ID = t2.ID and t1.Flagcolumn = 5
    END

求详细解释,多谢

JaneEyreWork的主页 JaneEyreWork | 初学一级 | 园豆:11
提问于:2016-07-05 09:55
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册