|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to Compare Date every day automatically?I got various Job Details listed in my table. I have set all jobs in a
such a way that they will be LIVE when Flag=1 and EXPIRED when Flag=0. But how can I compare the Expiry Job Date with the Current Date and Update Flag=0 automatically when its expired. I probably need compare everyday. I have no clue how to do this. I looked at Triggers but may be its not the one i'm looking for.. Is this possible in SQL Server? Thanks in Advance for your time and help something like this:
update jobs set flag=0 where expiry_date=convert(varchar(8),getdate(),112) set up a job to run this update daily. however, it seems redundant, to have both the expiry date and the flag in the table. dean Show quote "savvy" <johng***@gmail.com> wrote in message news:1138960957.385296.309670@g47g2000cwa.googlegroups.com... >I got various Job Details listed in my table. I have set all jobs in a > such a way that they will be LIVE when Flag=1 and EXPIRED when Flag=0. > But how can I compare the Expiry Job Date with the Current Date and > Update Flag=0 automatically when its expired. I probably need compare > everyday. > I have no clue how to do this. I looked at Triggers but may be its not > the one i'm looking for.. > Is this possible in SQL Server? > Thanks in Advance for your time and help > |
|||||||||||||||||||||||