Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Help with an update trigger

Author  Topic 

smccreadie
Aged Yak Warrior

505 Posts

Posted - 2001-06-22 : 13:08:32
I'm trying to use an update trigger to mark the current date in a field when a price is updated. My code is:

CREATE TRIGGER set_price_updt ON outpt_drug_costs 
FOR UPDATE
AS

IF UPDATE ([Unit Price*])
BEGIN
UPDATE outpt_drug_costs
SET price_updated = getdate()
FROM Inserted i JOIN Deleted d on i.sys_id = d.sys_id
WHERE i.sys_id = d.sys_id
END




This updates all the rows with the current datetime value. How do I select only the row that was updated?

   

- Advertisement -