Modify a JobModify a Job

适用对象: yesSQL ServeryesAzure SQL 数据库(仅限托管实例)noAzure SQL 数据仓库no并行数据仓库APPLIES TO: yesSQL Server yesAzure SQL Database (Managed Instance only) noAzure SQL Data Warehouse noParallel Data Warehouse

重要

Azure SQL 数据库托管实例目前支持大多数但并非所有 SQL Server 代理功能。On Azure SQL Database Managed Instance, most, but not all SQL Server Agent features are currently supported. 有关详细信息,请参阅 Azure SQL 数据库托管实例与 SQL Server 之间的 T-SQL 差异See Azure SQL Database Managed Instance T-SQL differences from SQL Server for details.

本主题介绍如何在 MicrosoftMicrosoft SQL ServerSQL ServerSQL Server 2017SQL Server 2017 或 SQL Server 管理对象更改 SQL Server Management StudioSQL Server Management Studio, Transact-SQLTransact-SQL, or SQL Server Management Objects.This topic describes how to change the properties of MicrosoftMicrosoft SQL ServerSQL Server Agent jobs in SQL Server 2017SQL Server 2017 by using SQL Server Management StudioSQL Server Management Studio, Transact-SQLTransact-SQL, or SQL Server Management Objects.

开始之前Before You Begin

限制和局限Limitations and Restrictions

SQL ServerSQL Server 代理主作业不能同时把本地服务器和远程服务器作为目标。A SQL ServerSQL Server Agent master job cannot be targeted at both local and remote servers.

安全性Security

除非您是 sysadmin 固定服务器角色的成员,否则您只能修改自己拥有的作业。Unless you are a member of the sysadmin fixed server role, you can only modify jobs that you own. 有关详细信息,请参阅实现 SQL Server 代理安全性For detailed information, see Implement SQL Server Agent Security.

使用 SQL Server Management StudioUsing SQL Server Management Studio

修改作业To modify a job

  1. “对象资源管理器” 中,连接到 SQL Server 数据库引擎SQL Server Database Engine的实例,然后展开该实例。In Object Explorer, connect to an instance of the SQL Server 数据库引擎SQL Server Database Engine, and then expand that instance.

  2. 展开“SQL Server 代理” ,再展开“作业” ,然后右键单击要修改的作业,再单击“属性” 。Expand SQL Server Agent, expand Jobs, right-click the job you want to modify, and then click Properties.

  3. “作业属性” 对话框中,使用相应的页来更新作业的属性、步骤、计划、警报和通知。In the Job Properties dialog box, update the job's properties, steps, schedule, alerts, and notifications using the corresponding pages.

使用 Transact-SQLUsing Transact-SQL

修改作业To modify a job

  1. 在对象资源管理器中,连接到数据库引擎实例,然后展开该实例。In Object Explorer, connect to an instance of the Database Engine, and then expand that instance.

  2. 在工具栏上,单击 “新建查询”On the toolbar, click New Query.

  3. 在查询窗口中,使用以下系统存储过程修改作业。In the query window, use the following system stored procedures to modify a job.

使用 SQL Server 管理对象Using SQL Server Management Objects

修改作业To modify a job

通过使用所选编程语言(如 Visual Basic、Visual C# 或 PowerShell)来使用 Job 类。Use the Job class by using a programming language that you choose, such as Visual Basic, Visual C#, or PowerShell. 有关详细信息,请参阅 SQL Server 管理对象 (SMO)For more information, see SQL Server Management Objects (SMO).