You are here: Re: Newbie trigger question « MsSQL Server « IT news, forums, messages
Re: Newbie trigger question

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация