简体   繁体   English

如何在SQL代理作业中执行存储过程?

[英]How do I execute a stored procedure in a SQL Agent job?

I am using SQL Server 2008 and I need to run a SQL Job from SQL Server Agent. 我正在使用SQL Server 2008,我需要从SQL Server代理运行SQL作业。 I am new to SQL Server Job and I want to execute a stored procedure regularly from a SQL Server Job. 我是SQL Server Job的新手,我想定期从SQL Server作业执行存储过程。 But I did not find where to specify the executed stored procedure other than copy & paste SQL commands. 但除了复制和粘贴SQL命令之外,我没有找到指定执行存储过程的位置。

Here is my screen snapshot: 这是我的屏幕快照:

在此输入图像描述

Any ideas how to assign stored procedure to execute in SQL Server Job? 有关如何分配存储过程以在SQL Server作业中执行的任何想法?

You just need to add this line to the window there: 您只需将此行添加到窗口:

exec (your stored proc name) (and possibly add parameters)

What is your stored proc called, and what parameters does it expect? 您调用的存储过程是什么,它期望什么参数?

As Marc says, you run it exactly like you would from the command line. 正如Marc所说,你完全按照命令行运行它。 See Creating SQL Server Agent Jobs on MSDN. 请参阅在MSDN上创建SQL Server代理作业

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM