SQL 如何调度存储过程?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2342935/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to schedule a stored procedure?
提问by Stefan Steiger
How do I schedule a stored procedure in Sql Server 2005 that it runs once at the start of every month (and on database startup)?
如何在 Sql Server 2005 中安排一个存储过程,它在每个月的开始(和数据库启动时)运行一次?
回答by Chris Porter
You will need to create a jobusing the SQL Server Agent.
您将需要使用SQL Server 代理创建作业。
回答by AdaTheDev
In SQL Server Management Studio, go expand the SQL Server Agentnode under the DB server, right click the Jobsfolder and select New Job...
在 SQL Server Management Studio 中,展开DB 服务器下的SQL Server Agent节点,右键单击Jobs文件夹并选择New Job...
(If the SQL Server Agent node does not appear, you may be missing the required permissions)
(如果没有出现 SQL Server 代理节点,则可能是您缺少所需的权限)
That will take you through a wizard to schedule a sproc to run on whatever schedule you want.
这将引导您完成一个向导来安排一个 sproc 以您想要的任何时间表运行。
In terms of how to get a sproc to run on db startup, see this article.
关于如何让 sproc 在 db 启动时运行,请参阅这篇文章。