title: How to ensure stored procedure finishes before building dataset in Report Builder 3.0?
body: <p>I want to refresh a table using a SSIS package every time the user runs a report built out of Report Builder 3.0, so I've created a SSIS job and call <code>sp_start_job</code> from Report Builder as a stored procedure to invoke this job.</p>
  
  <p>This all works fine, but the report doesn't wait for the job to finish before populating the dataset (I can tell because I have a "last refresh date" column in my table).</p>
  
  <p>Is there a way to make sure the job finishes before the data gets loaded into the report itself?</p>
  
  <p><strong>Edit:</strong> So I decided to try calling the job and waiting before the <code>SELECT</code> statement like this:</p>
  
  <pre><code>USE msdb;
  
  EXECUTE dbo.sp_start_job N'CUBE - IS Inventory Report Refresh'
  
  WAITFOR DELAY '00:00:25'
  
  USE OtherDatabase;
  
  SELECT  ...
  </code></pre>
  
  <p>but the timestamp is still showing an older date. The SSIS job runs in 17 seconds (from the history logs), so waiting for 25 seconds before I select from the table should be plenty... does anyone have insight on why this is happening?</p>
  
  <p>When I run the query in Management Studio, the table returned shows the right timestamp, so I'm thinking it might be a Report Builder issue (?)</p>