如何在sql server每小时运行一个存储过程? [英] How to run a stored procedure in sql server every hour?

查看:444
本文介绍了如何在sql server每小时运行一个存储过程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个表,我想每小时执行一些操作。为此,我创建了一个存储过程,但不知道如何每个小时调用它。我知道有一些计划的工作,但如何使用它们。

I have a table on which I want to perform some operations every hour. For this I created a Stored Procedure but don't know how to call it every hour. I know there are some kind of scheduled jobs, but how to use them.

有没有某种服务可以连续运行,每秒,我可以放置我的代码片段执行?

Is there some kind of service also that keeps on running continuously, every second, where I can place my piece of code to be executed ?

推荐答案

在SSMS中导航到SQL Server代理 - >作业
右键单击作业文件夹并选择新作业

In SSMS navigate to SQL Server Agent-->Jobs Right click on the Job Folder and select new job

在弹出的对话框中,给作业一个名字
点击步骤,然后在新的,你会看到一个类似下面的对话框,选择正确的DB并键入你的proc名称

on the dialog that pops up, give the job a name click on steps, then on new, you will see a dialog like the following, pick correct DB and type your proc name

之后点击进度,选择新的,你会看到类似下面的图像,填充所有的东西你需要,然后点击确定,点击确定的工作,你应该设置

after that click on schedule, pick new and you will see something like the image below, fill all the stuff you need and click ok, click ok on the job and you should be set

这篇关于如何在sql server每小时运行一个存储过程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆