how to deactivate a row when it's date exceeds one month automatically ?

i'm building an ASP.NET web application allows users to add an order "sell order" ,i want each order to be deactivated when it's date exceeds one or two months automatically.
- orders table must have the activated column which specifies the status of the order.
any help !!
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


You can write a sproc and it can be scheduled to run every day.

UPDATE tablename SET Activate = 'N' where DATEDIFF(m,OrderDate,GETDATE()) >= 2

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Hi, perhaps you should consider using Sql Job.
By definition, Jobs : Using SQL Server Agent you can create and schedule jobs that automate routine administrative tasks. Database administrators create jobs to perform predictable administrative functions either according to a schedule or in response of events and conditions. Jobs can be simple operations containing only a single job step or can be extremely complex operations containing many job steps. SQL Server Agent is responsible for management and execution of all jobs. Agent must be running for jobs to be executed. SQL server 2k supports jobs containing operating system commands.

take a look at this link, see if it is of any help:

RawasiAuthor Commented:
thanks all
- do you think this scenario is the best one i can use ?
- is this solution effects the performance of the database ?

   I believe this is the best solution. This will not effect the performance of the database.

There are so many jobs can be scheduled like this and are meant to perform like these tasks.

Create a job and schedule to run the job every day. The job should trigger the sproc that deactivate the orders(sql query)

The job should be scheduled to run at offpeak time where there will be less users connected.
Generally it is at night time.
This is the scenario where most of the applications work.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.