my experience with triggers is that it does something after an update,insert or delete. But is it possible to create a trigger to update a record automatically when its date is today? for example, I have a table with 4 columns.
StartDate EndDate Active Expired
---------------------------------------------------------------
2013-01-03 2013-01-05 True False
this is one record, what i want is to create a trigger that will update the Active column to False and Expired to True of this record when its EndDate is = today’s date (GETDATE()). How do i do this?
No, as far as I know, you can’t use a trigger for this situation.
Triggers are executed, when data/records change.
In your case, the data is not changing, only time is passing.
Look for a ‘SQL job’ to accomplish this task.