Search code examples
sqljobs

SQL how to make a job run a job?


I'd like to call another job immediately after first one has finished, or to be more precise is it possible to call an entire sql job via a job step. I'd like to avoid merging these jobs into 1 so I wonder if this solution is possible?


Solution

  • Yes, you can execute a job by using this stored procedure. In your case, you can simply add a step to the end of your first job, to call the name of the job you want executed next.

    EXEC msdb.dbo.sp_start_job N'Job Name';
    

    See sp_start_job (Transact-SQL) for more information.