title: Append header and Footer to the csv data
body: <p>I need to export data to CSV using a stored procedure. I am using the <code>bcp.exe</code> utility to export data</p>
  
  <pre><code>select @sql = 'bcp dbo.Customers out c:\bcp\customers.txt -c -t, -T -S'+ @@servername
  exec master..xp_cmdshell @sql
  </code></pre>
  
  <p>I need to add a header with the column names and a text <code>File Ended</code>' at the end of the CSV.</p>
  
  <p>Table structure is like this</p>
  
  <pre><code>ID    Name
   1    'joe'
   2    'jon'
  </code></pre>
  
  <p>In CSV it should be like this</p>
  
  <pre><code>ID,Name
  1,joe
  2,jon
  END_OF_FILE
  </code></pre>
  
  <p>I have created a view that will have column header and data</p>
  
  <pre><code>select 'ID' as ID , 'Name' as Name 
  union all 
  select ID, Name from Customer
  </code></pre>
  
  <p>I need to append <code>File Ended</code> at the end of the CSV</p>
  
  <p>Any idea will be appreciated</p>