Call SQL Agent Job on different instance

Mark Sanchez 101 Reputation points
2021-09-22T14:38:15.093+00:00

I have a SQL Job on a 2008 R2 instance and would like as it's final step to start another SQL job on a SQL 2019 instance. Is this possible?

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,310 questions
0 comments No comments
{count} votes

Accepted answer
  1. Erland Sommarskog 106.5K Reputation points
    2021-09-22T22:10:07.513+00:00

    You can set up a CmdExec job that connects with SQLCMD to the other instance and runs sp_start_job. You would have create a proxy user that has permissions to start jobs on the other instance, and you would select this user as Run As for the job.

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. AmeliaGu-MSFT 13,971 Reputation points Microsoft Vendor
    2021-09-23T06:03:45.86+00:00

    Hi MarkSanchez-5028,
    You also can try to configure a linked server to Server 2 in SQL Server 1, and use the linked server with executing msdb.dbo.sp_start_job to call the SQL Server job in Server 2 as the final step of Server 1 job.

    EXEC [Server 2].[msdb].[dbo].[sp_start_job] @job_name = N'jobname';  
    

    Please refer to How to Create a SQL Server Agent Job that Calls Another Job and How to start SQL Agent job from Another server for more details.

    Best Regards,
    Amelia


    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.