每半小时执行一次存储过程. [英] Execution of Stored Procedure for every half an hour.
本文介绍了每半小时执行一次存储过程.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
亲爱的朋友,
我已经创建了一个存储过程,我希望它每半小时执行一次.
有人建议我该怎么办.
我这样使用.这是个好习惯吗?
而(1 = 1)
开始
开始尝试
Exec SP
等待延迟''00:30:00''
结束尝试
开始抓捕
尾部
问候,
AP
Dear Friends,
I have created a Stored Procedure, I want it to execute for every half an hour.
Kindly any one suggest what can I do.
I use like this. Is this good practice.
while (1=1)
begin
begin try
Exec SP
waitfor delay ''00:30:00''
end try
begin catch
end catch
Regards,
AP
推荐答案
您需要创建一个SQL服务器作业,该作业将定期执行
http://msdn.microsoft.com/en-us/library/ms187910.aspx [ ^ ]
You need to create a SQL server job which will execute periodically
http://msdn.microsoft.com/en-us/library/ms187910.aspx[^]
您可以使用SQL Agent设置一个新作业,该作业将以给定的时间间隔(在您的情况下为每半小时)触发.以下是有关SQL Automation的更多信息:
http://msdn.microsoft.com/en-us/library/ms189880(SQL .105).aspx [ ^ ]
You can use the SQL Agent to set up a new job that will fire at a given interval (in your case, every half hour). Here is more information on SQL Automation:
http://msdn.microsoft.com/en-us/library/ms189880(SQL.105).aspx[^]
在SQL Server Agent
上安排它 SQL作业 [ SQL CMD实用程序 [任务计划程序 [^ ]
类似的讨论:
如何运行存储过程每天 [ ^ ]
Schedule it onSQL Server Agent
SQL Jobs[^]
Also you can use SQL CMD Utility[^] with Task Scheduler[^]
Similar discussion:
How to run a stored procedure every day[^]
这篇关于每半小时执行一次存储过程.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文