Hi

export csv Using SQL with OPENROWSET to Write to Excel

 INSERT INTO OPENROWSET('Microsoft.ACE.OLEDB.12.0',

   'Excel 12.0;Database=C:\output.xlsx;HDR=YES;',

   'SELECT * FROM [Sheet1$]')

SELECT * FROM YourTable;



Requires ACE OLEDB driver to be installed and may need Ad Hoc Distributed Queries enabled.
Previous
Next Post »