sp_delete_jobschedule (Transact-SQL)

Applies to: SQL Server Azure SQL Managed Instance

Deletes a schedule for a job in the SQL Server Agent service.

sp_delete_jobschedule is provided for backward compatibility only.

This feature will be removed in a future version of SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature.

Remarks

Job schedules can now be managed independently of jobs. To remove a schedule from a job, use sp_detach_schedule. To delete a schedule, use sp_delete_schedule.

sp_delete_jobschedule doesn't support schedules that are attached to multiple jobs. If an existing script calls sp_delete_jobschedule to remove a schedule that is attached to more than one job, the procedure returns an error.

Permissions

You can grant EXECUTE permissions on this procedure, but these permissions might be overridden during a SQL Server upgrade.

Other users must be granted one of the following SQL Server Agent fixed database roles in the msdb database:

  • SQLAgentUserRole
  • SQLAgentReaderRole
  • SQLAgentOperatorRole

For details about the permissions of these roles, see SQL Server Agent Fixed Database Roles.

Members of the sysadmin role can delete any job schedule. Users who aren't members of the sysadmin role can only delete job schedules that they own.