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?
SQL Server Agent is the job scheduling tool for SQL Server. To execute a job on demand using the GUI, open the SQL Server Agent tree, expand Jobs, select the job you want to run, right click on that job and click 'Start Job' and the job will execute.
Under the job step properties click on "advanced", you can then restart the job on step 1. It also gives you the option to retry a number of times before aborting and ending.
When you create a SQL Server Agent Job of any type other than T-SQL you'll have an extra drop-down box that will allow you to select the credential that you want to use. Select the credential from the drop-down, and the next time the job runs, the job step will be run as the account specified in the credential.
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.
create a T-SQl Step and use EXEC msdb.dbo.sp_start_job N'YourJob';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With