Posted by Tim on 09/29/05 00:46
-- Does the following Query do what your query is supposed to
-- If so the trigger should be about what you want.
UPDATE dest SET dest.price = src.price
-- SELECT dest.price, src.price, dest.prod_id, src.prod_id
FROM product src
JOIN link l ON src.prod_id = l.id
JOIN product dest ON l.related_id = dest.prod_id
WHERE dest.prod_id <> src.prod_id AND src.prod_id = xxxyz
CREATE TRIGGER product__update ON dbo.product
FOR UPDATE AS
BEGIN
UPDATE dest SET dest.price = src.price
FROM inserted src
JOIN link l ON src.prod_id = l.id
JOIN product dest ON l.related_id = dest.prod_id
WHERE dest.prod_id <> src.prod_id
-- AND dest.price <> src.price -- Add this if Price is a NOT NULL
Column
END
Tim S
Navigation:
[Reply to this message]
|