I want to create a trigger that will update the column LastActivityDate to the current date when the Description column is updated, the problem is that all the rows are being updated, and I don’t know how to make the where clause inside the trigger…
I need to make a trigger like this for other tables as well, like the Votes table…
I have:
CREATE TRIGGER test ON Articles FOR INSERT, UPDATE AS IF UPDATE(Description) UPDATE Articles SET LastActivityDate = GETUTCDATE()
How would the where clause be?
You can join to the inserted table to limit the update to the rows updated .