title: Wait until SQL Server Agent Job finishes
body: <p>I am running a query to execute/start a SQL Server Agent Job which takes sometimes 4 to 5 hours to finish.  I would like to wait until that job finishes and then continue with the program/code.</p>
  
  <p>Here is my query I am running to start the stored procedure:</p>
  
  <pre><code>                Dim connectionString As String = "HIDDEN"
                  Dim con As SqlConnection = New SqlConnection(connectionString)
  
                  con.Open()
                  Dim cmd As SqlCommand = New SqlCommand()
                  cmd.Connection = con
                  cmd.CommandText = "USE msdb; EXEC dbo.sp_start_job N'FWP FULL Daily'"
                  cmd.CommandType = CommandType.Text
                  cmd.ExecuteNonQuery()
                  con.Close()
                  //  -- WAIT UNTIL STORED PROCEDURE FINISHES --
  
                  //Continue Code From Here on..........
  </code></pre>
  
  <p>How would I do this??</p>
  
  <p>Thank you.</p>