ilija veselica
ilija veselica

Reputation: 9574

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?

Upvotes: 9

Views: 6677

Answers (3)

Diego
Diego

Reputation: 36146

create a T-SQl Step and use EXEC msdb.dbo.sp_start_job N'YourJob';

Upvotes: 1

CloudyMarble
CloudyMarble

Reputation: 37566

Call the Jobs in the order you wish from a stored procedure.

Upvotes: -1

mservidio
mservidio

Reputation: 13057

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.

Upvotes: 5

Related Questions