title: SSIS - write flat file header containing rowcount of the data file
body: <p>I am creating an SSIS package that will write in the header of a text file</p>
  
  <p><strong>STARTDATE|ENDDATE|ROWCOUNT</strong></p>
  
  <p>followed by the results of a stored procedure.  ROWCOUNT is the number of rows in the data set from the stored procedure.  The data set is written to the body of the flat file.</p>
  
  <p>My package is successful.  It has three data flow tasks:<br>
   DetermineRowCount, 
   WriteHeader, and 
   WriteData.</p>
  
  <p>DetermineRowCount and WriteData both hit a copy of the same OLE DB Source - Data item. </p>
  
  <p>DetermineRowCount data flow is OLE DB Source - Data ---> Row Count where the RowCount variable is set. </p>
  
  <p><strong>I would like to eliminate one copy of the OLE DB Source - Data.</strong>  </p>
  
  <p>Is there a way to obtain the RowCount <strong><em>and</em></strong> the data, write the header, then write the body, without calling the stored procedure twice?</p>