sp_delete_job还会删除关联的作业步骤吗?

时间:2017-06-22 17:27:54

标签: sql-server sql-job

sp_delete_job还会删除关联的作业步骤吗?

1 个答案:

答案 0 :(得分:2)

如果您编写sp_delete_job脚本,您将看到脚本末尾附近:(假设是SQL Server)

DELETE FROM msdb.dbo.sysjobschedules
WHERE job_id IN (SELECT job_id FROM #temp_jobs_to_delete)

DELETE FROM msdb.dbo.sysjobservers
WHERE job_id IN (SELECT job_id FROM #temp_jobs_to_delete)

DELETE FROM msdb.dbo.sysjobsteps
WHERE job_id IN (SELECT job_id FROM #temp_jobs_to_delete)

DELETE FROM msdb.dbo.sysjobs
WHERE job_id IN (SELECT job_id FROM #temp_jobs_to_delete)