How to run a stored procedure in sql server every hour?(如何每小时在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 Agent-->Jobs右键单击作业文件夹并选择新作业
In SSMS navigate to SQL Server Agent-->Jobs Right click on the Job Folder and select new job
在弹出的对话框中,给工作起个名字单击步骤,然后单击新建,您将看到如下所示的对话框,选择正确的数据库并输入您的 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中运行一个存储过程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何每小时在sql server中运行一个存储过程?
基础教程推荐
- SQL:使用来自具有相同列名的两个表中的数据... 2021-01-01
- SSMS 中的权限问题:“对象 'extended_properties'、数据库 'mssqlsystem_resource'、... 错误 229)上的 SELECT 权限被拒绝" 2022-01-01
- 在 SQL 中连接多个表 2021-01-01
- 需要 MySQL 5.1 中的抽象触发器来更新审计日志 2021-01-01
- 无法解决整理冲突 2021-01-01
- 是否可以执行按位分组功能? 2021-01-01
- 如何使用 mysql.connector 禁用查询缓存 2022-01-01
- 将 SQL Server DateTime 列迁移到 DateTimeOffset 2021-01-01
- SQL Server 实例在登录协商期间返回无效或不受支持的协议版本 2021-01-01
- SQL 效率:WHERE IN 子查询 vs. JOIN 然后 GROUP 2021-01-01
