title: Adding an EOF row count to a Flat File Destination
body: <p>I have an SSIS 2008 package that queries a database, concatenates various data elements into pipe-delimited rows, and then outputs the results to a flat file. This all works just fine.</p>
  
  <p>However, the last row of the file has to be this: EOF|NNNNN| where NNNNN is the number of data rows present in the file.</p>
  
  <p>I would just output @@ROWCOUNT, however the queries all have a UNION ALL in them, and so @@ROWCOUNT returns an incorrect result.</p>
  
  <p>Obviously I could shell out to the CLR with a script task, open the text file, and count the rows that way, but I'd rather avoid the performance hit, and keeping it all in the SSIS data flow is cleaner, and more easily understood.</p>
  
  <p>Suggestions? I feel like I'm missing something obvious. TIA!</p>