CREATE TRIGGER [dbo].[TrTermCondition] ON [dbo].[TermCondition]
FOR INSERT, UPDATE, DELETE
AS
DECLARE @VendorID AS INT
IF EXISTS (SELECT 1 FROM INSERTED)
BEGIN
SELECT @VendorID = VendorID
FROM INSERTED
UPDATE BUYER
SET IsSalesTermsAccepted = 0,
ModifiedDt = getDate(),
ModifiedUserID = 55
FROM Buyer B
INNER JOIN VendorBuyers VB ON VB.BuyerID = B.ID
WHERE VB.VendorID = @VendorID
END
FOR INSERT, UPDATE, DELETE
AS
DECLARE @VendorID AS INT
IF EXISTS (SELECT 1 FROM INSERTED)
BEGIN
SELECT @VendorID = VendorID
FROM INSERTED
UPDATE BUYER
SET IsSalesTermsAccepted = 0,
ModifiedDt = getDate(),
ModifiedUserID = 55
FROM Buyer B
INNER JOIN VendorBuyers VB ON VB.BuyerID = B.ID
WHERE VB.VendorID = @VendorID
END
No comments:
Post a Comment