I know some jobs can be run periodically or querys a database. how achievement run this code every "x" days in an azure sql table?
DELETE FROM [MobileServiceExtra].[ACTIVITY]
WHERE [NewsItemDate] < GETDATE()- 5
Windows Azure Scheduler is a new service that has just gone into preview - http://www.windowsazure.com/en-us/services/scheduler/. This looks like an all-purpose service to do this kind of thing. I don't expect SQL on Azure will ever support Agent.
It would seem that Azure does not support SQL Server Agent and scheduling of jobs.
According to a series of blog posts on MSDN you can however use the Windows Azure Worker role to schedule custom jobs (that run SQL):
I Miss You SQL Server Agent: Part 1
I haven't tried this, so I can't tell you if it's a viable solution.
We use Quartz.Net within our Azure combined web and worker role.
You can see my colleagues post about it here
It looks like you're using Mobile Services. Mobile Services comes with a Scheduler which can connect to your database and do whatever you need in a recurring schedule.
More information:
Build your own SQL Server Agent for Windows Azure SQL Database with the Scheduler
You would end up writing a little bit of javascript in the Scheduler which will run your SQL statement:
function Call_sp_ClearOldLogs() {
console.log("Executing sp_ClearOldLogs...");
mssql.query('EXEC dbo.sp_ClearOldLogs', {
success: function(results) {
console.log("Finished executing sp_ClearOldLogs.");
}
});
}
You can use windows azure scheduler preview right now http://www.windowsazure.com/en-us/services/scheduler/.
Do check out the pricing,right now they are charging $10/month and it will be increased to $20/month once the preview period is over.
You can also try aditi scheduler http://www.aditicloud.com/ as well,the only issue with aditi scheduler is its available in azure store ( which is not accessible in many countries) and you have to use your credit card again to consume it.
Hope it helps!
Thanks.
Mohit Chhabra
If you are open to using a service for this, we offer this functionality within our Cotega service. The way that it works is that you create a stored procedure within your database to execute this code and simply set up a schedule for how often you want it to run.
You can use Azure Automation Runbook. Example here. I use this for daily table truncation, works perfect for me.