title: How can I measure the duration of a package execution?
body: <p>I have an SSIS job that I would like to run from a procedure, and then, using the job start and job end date execute a select statement. </p>
  
  <p>Getting the job start time is easy- just save the current time from just before you call the job. </p>
  
  <p>How can I get the end tim? Can I use <code>@endTime = GETDATE()</code>? Does starting the job wait for it to end ? </p>
  
  <p>Is it true in general about calls inside SQL procedures?</p>
  
  <p>EDIT:
  As people asked, I wanted to call an SSIS job using this code, which I found <a href="https://www.mssqltips.com/sqlservertip/2992/how-to-execute-an-integration-services-ssis-package-from-a-sql-server-stored-procedure/" rel="nofollow noreferrer">here</a>:</p>
  
  <pre><code> declare @execution_id bigint
   exec ssisdb.catalog.create_execution 
   @folder_name = 'mssqltips'
   ,@project_name = 'exec-ssis-stored-proc-ssis-sample'
   ,@package_name = 'Sample.dtsx'
   ,@execution_id = @execution_id output
   exec ssisdb.catalog.start_execution @execution_id
  </code></pre>