NightKnight
NightKnight

Reputation: 331

Update Database automatically at specific time

I have one issue, but I'm not getting a solution. I tried Google too.

I want to update my SQL database on the first day of every month (i.e. 01/01/2012, 01/02/2012, 01/03/2012, etc.) I am using C# (code behind language) and ASP.NET. I do not want any human effort for this. I want this update to be done automatically, on a specific date. Is there any kind of solution that can solve my problem?

If I am not clear about my doubt then let me know.

Upvotes: 0

Views: 3028

Answers (4)

hzrari
hzrari

Reputation: 1933

you have to create a script or an application that updates your database, and schedule it in the task scheduler if your are using Windows...

Upvotes: 1

jrummell
jrummell

Reputation: 43067

ASP.NET is not the best option for a scheduled task. A simple console app scheduled with Windows Task Scheduler is a better option.

Upvotes: 1

Taryn
Taryn

Reputation: 247630

If you have access to the SQL Server Job Agent, I would create a stored procedure that contains the UPDATE code and then use a Job to run the stored proc each month on the first day of the month.

Your steps would be:

  1. Create stored procedure with your UPDATE
  2. Create a new SQL Agent Job that executes your stored proc
  3. When setting the schedule on the SQL Agent Job, set it as recurring > Monthly > The first day of every 1 month.

enter image description here

Upvotes: 0

Bridge
Bridge

Reputation: 30651

Why not create an application that does the update you require, and then set up a schedule to run it with the Windows Task Scheduler?

Upvotes: 3

Related Questions