I have a table with 3 fields [ID, Name, LastUpdated].
LastUpdated has a default value of "GetDate() so it automatically fills itself when a new record is added.
When I instead run an UPDATE on TABLE, I would like to have this field reset itself to the current GetDate().
CREATE TRIGGER dbo.Table1_Updated
ON dbo.Table1
AFTER UPDATE
AS
BEGIN
SET NOCOUNT ON;
UPDATE dbo.Table1 SET LastUpdated = GETDATE()
END
GO
But because I don't have a WHERE Clause, ALL records get updated.
QUESTION:
Where would I get the value of the ID of the updated record on a UPDATE Trigger?
Would the fact that I'm updating a field of the table inside the Trigger, re-call a new Trigger event (and so on) ?