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 Server 字符串到日期的转换 2021-01-01
- 将数据从 MS SQL 迁移到 PostgreSQL? 2022-01-01
- 在 VB.NET 中更新 SQL Server DateTime 列 2021-01-01
- 如何在 SQL Server 的嵌套过程中处理事务? 2021-01-01
- SQL Server:只有 GROUP BY 中的最后一个条目 2021-01-01
- 无法在 ubuntu 中启动 mysql 服务器 2021-01-01
- ERROR 2006 (HY000): MySQL 服务器已经消失 2021-01-01
- SQL Server 中单行 MERGE/upsert 的语法 2021-01-01
- 使用pyodbc“不安全"的Python多处理和数据库访问? 2022-01-01
- SQL Server 2016更改对象所有者 2022-01-01