Hi All,
I was wondering if anyone of you has a solution to be able to update 1 single row on a table with a trigger. I am trying to keep track of the modification dates on certain tables. So when someone updates a record it will stamp the current date on the modifydate field. So far, I have only been able to update ALL the records on a table when the trigger fires.
I used something like this:
Create Trigger UpdateDate
on tablename
FOR UPDATE
AS
UPDATE tablename
SET modifydate = getdate()
WHERE....... Here is where I get stopped. without a where clause I obviously get to update all the records in the table but.. I just dont know how to tell SQL in that where clause to update JUST the record that was updated.
I think that this is a common thing that gets used quite often (that I cant get right
) so I am sure many of you might have an Idea of how to come about this. Any kind of help would be really appreciated though.
Thank you,
I was wondering if anyone of you has a solution to be able to update 1 single row on a table with a trigger. I am trying to keep track of the modification dates on certain tables. So when someone updates a record it will stamp the current date on the modifydate field. So far, I have only been able to update ALL the records on a table when the trigger fires.
I used something like this:
Create Trigger UpdateDate
on tablename
FOR UPDATE
AS
UPDATE tablename
SET modifydate = getdate()
WHERE....... Here is where I get stopped. without a where clause I obviously get to update all the records in the table but.. I just dont know how to tell SQL in that where clause to update JUST the record that was updated.
I think that this is a common thing that gets used quite often (that I cant get right

Thank you,