title: Writing whole table data ( including relevant column names ) to Excel with using T-SQL
body: <p>The issue is I'm trying to add/write column names with sequenced order over Excel environment and its cells ( e.g. first column name should be placed A1 cell and others following as B1, C1... ) and bind/write relevant data to under these columns. However the result that I want to achieve is not like above ( e.g. column names not following A1, B1, C1 order ) but placed in vertical order ( e.g. A1, A2, A3 etc. ) in .xls environment .</p>
  <p>The sample code is that I've already working with to overcome this issue:</p>
  <p>Firstly I'm taking column names and writing over .xls file:</p>
  <pre><code>INSERT INTO OPENROWSET('Microsoft.ACE.OLEDB.12.0','Excel 12.0; Database=D:\dummy.xlsx;','SELECT * FROM [Sheet1$]') 
  SELECT COLUMN_NAME 
  FROM dummy_db.INFORMATION_SCHEMA.COLUMNS 
  WHERE TABLE_NAME = 'dummy_table';
  </code></pre>
  <p>And adding relevant data to same .xls file:</p>
  <pre><code>INSERT INTO OPENROWSET('Microsoft.ACE.OLEDB.12.0','Excel 12.0; Database=D:\dummy_output.xlsx;','SELECT * FROM [Sheet1$]') 
  SELECT * 
  FROM [dbo].[dummy_table]
  </code></pre>
  <p>How do I overcome to export whole table to .xls environment with using T-SQL in an effective way?</p>