SQL Agent Job Chaining
It would be a great feature to make SQL Agent Jobs hierarchical so that one (or more) job(s) can be dependent on another job allowing SQL Agent Jobs to be chained together.
Kurt Moskal commented
A slight modification to the original request Add new option(s) to the "Notifications" for when the job completes.
Add additional check boxes to do something. Examples of what to do:
1. Run Powershell script
2: Start a different SQL Agent Job (Chaining)
3. Run an executable
You already morphed the subject of "Notifications" when "Automatically delete job" was added. That isn't really a notification. It's more like doing something when the job ends. So just add more things to do.
Al Howarth commented
OP, Are you requesting dependencies?
IE, Job1, Job2 and Job3 can run anytime during the day. Job4 will start when all three are done?
Just want to be sure what you are asking, so I can vote, or create my own suggestion if I'm misunderstanding. We looked at AutoSys and its dependencies feature is we want to replicate in SQL Agent.
John G Hohengarten commented
I think this could be implemented if Microsoft adds a new SQL Agent Job Step type of `SQL Server Agent Job` (along with the rest of the others like ActiveX Script, Operating system (CmdExec), etc.) found under the "Type" dropdown in New Job Step window. (via right click New Job).
Yeah, we use sp_start_job to start other jobs in a lot of scenarios. It's fairly straight-forward as long as you have the right security in place. We even start jobs on different servers.
Easy enough. T-SQL jobstep using exec msdb.dbo.sp_start_job, potentially dependent on some select from msdb.dbo.sysjobhistory.