我有这个触发器我想让它允许多行更新,目前它只处理单行更新。当我更新记录时,它说子查询返回超过 1 个值..
GO
ALTER TRIGGER [dbo].[OnReceiptUpdate]
ON [dbo].[paymentReceipt]
AFTER UPDATE
AS
BEGIN
SET NOCOUNT ON;
Declare @correctdate VARCHAR(19);
Declare @receiptNo VARCHAR(50);
DECLARE @customerID NCHAR(50)
SET @customerID= (SELECT customerID FROM inserted)
set @correctdate = (SELECT CONVERT(VARCHAR(19),paymentDate,103) FROM inserted)
set @receiptNo = (SELECT receiptNo FROM inserted)
BEGIN
UPDATE Paymentreceipt
SET paymentDate = @correctdate
WHERE customerID = @customerID and receiptNo=@receiptNo
END
END