Maybe a trigger isn't best for this. I have a field called Status in my Projects table. I want to update the StatusChanged date/time field only when the Status of the Project has been changed.
Either way, if I were to use a trigger, how would I check to see what the value of the Status field is BEFORE the field is updated and then compare it to the field's value afterward and update the StatusChanged field only if there is a difference? Or perhaps I should have a completely separate status table with ProjectID, status and statuschanged fields and fire off a stored procedure using a trigger every time the Projects table is updated - which do you think would be the most efficient?
Thanks!
P
Either way, if I were to use a trigger, how would I check to see what the value of the Status field is BEFORE the field is updated and then compare it to the field's value afterward and update the StatusChanged field only if there is a difference? Or perhaps I should have a completely separate status table with ProjectID, status and statuschanged fields and fire off a stored procedure using a trigger every time the Projects table is updated - which do you think would be the most efficient?
Thanks!
P