如何每小时在sql server中运行一个存储过程?

How to run a stored procedure in sql server every hour?(如何每小时在sql server中运行一个存储过程?)
本文介绍了如何每小时在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中运行一个存储过程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Execute complex raw SQL query in EF6(在EF6中执行复杂的原始SQL查询)
Hibernate reactive No Vert.x context active in aws rds(AWS RDS中的休眠反应性非Vert.x上下文处于活动状态)
Bulk insert with mysql2 and NodeJs throws 500(使用mysql2和NodeJS的大容量插入抛出500)
Flask + PyMySQL giving error no attribute #39;settimeout#39;(FlASK+PyMySQL给出错误,没有属性#39;setTimeout#39;)
auto_increment column for a group of rows?(一组行的AUTO_INCREMENT列?)
Sort by ID DESC(按ID代码排序)