如何在微软的Azure截断SQL数据库定期

问题描述:

我对微软Azure上运行SQL数据库。以$ P $变得过于大pventing吧,我一定要定期截断它(例如,一两天)。
截断表XXX 是我需要执行的SQL。

I have a SQL database running on Microsoft Azure. To preventing it from getting too big, I have to truncate it periodically (e.g., a day or two). truncate table xxx is the SQL that I need to execute.

那么,什么是实现这一目标的最简单的方法?我preFER没有写任何C#code,除非我必须这样做。我可以用它连续运行截断SQL语句中的网络工作?或者,我可以使用Azure的SQL数据库的内置功能来实现这一目标?谢谢!

So what is the easiest way to achieve this? I prefer not writing any C# code unless I have to do so. Can I use a web job which continuously running a truncate SQL statement? Or can I use a built-in functionality of SQL database on the Azure to achieve this? Thanks!

SQL Azure中还没有任何形式的SQL代理功能,所以你必须创建一个Web作业(或一些JavaScript的执行您需要执行的SQL ),然后使用Azure的计划来安排工作。

SQL Azure does not yet have any sort of SQL Agent functionality so you'll have to create a web job (or some JavaScript that executes the SQL you need executed) and then use Azure Scheduler to schedule the job.

您还可以使用Azure的自动化,涉及PowerShell来做到同样的事情。

You can also use Azure Automation that involves Powershell to do the same thing.