我需要对几行进行触发,但是我不知道如何尝试搜索,但是我只能设法找到那里的代码,我想知道是否有人可以帮助我。谢谢。

Create Trigger UXExcelFile_DELETE on UXExcelFile
after delete
AS
Begin
Set nocount on
Declare @TransDate date
Declare @TransTime Time(7)
Declare  @CardNo  varchar(255)
Declare @VoucherNo varchar(255)
Declare @Quantity varchar(150)
Declare @TransactionValue varchar(150)
Declare @Morada varchar(255)

select @TransDate =deleted.TransDate,@TransTime=deleted.TransTime,@CardNo = deleted.CardNo, @VoucherNo = deleted.VoucherNo, @Quantity = deleted.Quantity, @TransactionValue = deleted.TransactionValue, @Morada = deleted.Morada from deleted

Insert into UXExcelFileTrigger (TransDate,TransTime,CardNo,VoucherNo,Quantity,TransactionValue,Morada)values(@TransDate,@TransTime,@CardNo,@VoucherNo,@Quantity,@TransactionValue,@Morada)

END

最佳答案

我没有测试代码,但是我想它将是这样的:

Create Trigger UXExcelFile_DELETE on UXExcelFile
after delete
AS
Begin
Set nocount on

Insert into UXExcelFileTrigger (TransDate,TransTime,CardNo,VoucherNo,Quantity,TransactionValue,Morada)
    SELECT TransDate, TransTime, CardNo, VoucherNo, Quantity, TransactionValue, Morada
    FROM deleted

END

关于mysql - SQL删除触发多行,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/48890926/

10-11 02:58