title: How to implement SQL Server Job that waits to another job finish?
body: <p>I'm looking a way to implement a precedence step on SQL Server Agent that will verify is a specific job is running. If so, the step will entry in a "wait" state until first job finish with success.</p>
  
  <p>To clarify, this will be the cenario:</p>
  
  <p>Job Name: 'My Job'</p>
  
  <p>Job to be checked: 'Validate tables'</p>
  
  <p>Steps of 'My job':</p>
  
  <p>Step 1: Check if 'Validate tables' is running
  Step 2: Do something else</p>
  
  <p>On Step 1, need to use some T-SQL like this:
  exec msdb.dbo.sp_help_job @job_name='Validade tables',@job_aspect ='JOB'</p>
  
  <p>If the current_execution_status is equal to 1, then will wait (will not run the step 2)</p>
  
  <p>I'm not an expert on SQL Server Agent, so I need some help on this.</p>
  
  <p>Thanks in advance.</p>