feesu
asked on
Timer in SQL Server 2000
Experts,
How can i have something like a timer in SQL Server 2000 that checks every fixed period of time on an expiry date in my table and set a column called 'Active' = TRUE/FALSE accordingly?
How can i have something like a timer in SQL Server 2000 that checks every fixed period of time on an expiry date in my table and set a column called 'Active' = TRUE/FALSE accordingly?
ASKER
I've never done that before. Any sample code?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
i think you can create a computed column and it automatically computes the value depending on the data.
something like this
CREATE TABLE sampletable (
expiry_date datetime,
ISACTIVE AS case when expiry_date > getdate() then 'true' else 'false',
other fields
)
something like this
CREATE TABLE sampletable (
expiry_date datetime,
ISACTIVE AS case when expiry_date > getdate() then 'true' else 'false',
other fields
)
It would need to update your table setting active = false if the expiry date is less than the current date.