Skip to content

Commit

Permalink
Revert 2.19 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
bclothier committed Jun 8, 2016
1 parent 739381e commit 6b4636c
Showing 1 changed file with 2 additions and 25 deletions.
27 changes: 2 additions & 25 deletions Microsoft SQL Server/Chapter 02/Listing 2.019.sql
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ GO

-- Listing 2.19 SQL for sample trigger to maintain computed value
CREATE TRIGGER updateOrdersOrderTotalsTrig
-- <<<<<<< HEAD
ON Orders AFTER INSERT, UPDATE, DELETE AS
BEGIN
UPDATE Orders
Expand All @@ -20,31 +19,9 @@ BEGIN
SELECT OrderNumber FROM deleted
UNION
SELECT OrderNumber FROM inserted
-- =======
ON Order_Details AFTER INSERT, UPDATE, DELETE
AS
BEGIN

UPDATE O
SET OrderTotal = (
SELECT SUM(QuantityOrdered * QuotedPrice)
FROM Order_Details OD
WHERE OD.OrderNumber = O.OrderNumber
)
FROM Orders O
WHERE O.OrderNumber IN (
SELECT OrderNumber FROM deleted
UNION
SELECT OrderNumber FROM inserted
-- >>>>>>> origin/master
);
END;

-- <<<<<<< HEAD
DROP TRIGGER updateOrdersOrderTotalsTrig;
-- =======

-- Run the following if you do not wish to keep the trigger in the database.
--DROP TRIGGER updateOrdersOrderTotalsTrig;
-- >>>>>>> origin/master
GO

DROP TRIGGER updateOrdersOrderTotalsTrig;

0 comments on commit 6b4636c

Please sign in to comment.