zoukankan      html  css  js  c++  java
  • After delete Trigger throw error:The row value(s) updated or deleted either do not make the row unique or they alter multiple rows (2 rows).

    在after delete触发器中执行update语句,更新另外一个表单数据

    ALTER TRIGGER [dbo].[UpdateBookOfStudentFlag]
    on [dbo].[tblBookInvoiceDetail]
    AFTER DELETE
    AS
    BEGIN

    update BookOfStudent set flag_orderUsed=0 where BookOfStudent.id = 52812--(select Book_ofStudent_Id from deleted)

    END

    表错,提示受影响的行数多于1

    The row value(s) updated or deleted either do not make the row unique or they alter multiple rows (2 rows).

    简单地在触发器中设置

    SET NOCOUNT ON即可

    ALTER TRIGGER [dbo].[UpdateBookOfStudentFlag]
    on [dbo].[tblBookInvoiceDetail]
    AFTER DELETE
    AS
    BEGIN
    SET NOCOUNT ON
    update BookOfStudent set flag_orderUsed=0 where BookOfStudent.id = 52812--(select Book_ofStudent_Id from deleted)
    SET NOCOUNT OFF
    END

  • 相关阅读:
    2019年10月24日打印个人信息清单
    vsftp安装
    网络连接
    mysql多种方法修改密码----5.6的坑
    openstack-L版安装
    openstack是什么
    kvm快照
    文件操作
    函数
    virt-manage图形界面键盘错位问题
  • 原文地址:https://www.cnblogs.com/zyip/p/2827639.html
Copyright © 2011-2022 走看看