Sunday, January 19, 2014

How to invoke a SQL job from another Job present on a different instance





How to invoke a SQL job from another Job present on a different instance:


For invoking an SQL Server Job from another Job which is present on a different instance, we have different ways like
  1. Create a Linked server and use msdb..sp_start_job to start the job
  2. Using xp_cmdshell
  3. Using SQLCMD Operating system command
In most of the SQL Server instances the xp_cmdshell will be disable due to security reasons and creating linked server is time consuming.
So, the most easy approach would be to use the SQLCMD Operating system command.
Create a new step in the job with the type "Operating System (CmdExec)" and use the below command

SQLCMD -S <Server Name> -E -Q "EXEC msdb..sp_start_job <Job Name>"


 

1 comment:

  1. The Learn CPQ Salesforce Learn CPQ Salesforce course teaches you to configure, price, and quote products efficiently using Salesforce CPQ. Master automation to streamline sales processes and close deals faster.

    ReplyDelete