sql stored procedure to export to excel
Posted on 2014-12-19
Hi - I am trying to write a stored procedure to export the data from a table to excel document.
May I know how to do this, I tried to in the below way but that did not work.
INSERT INTO OPENROWSET ('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=C:\Report\test.xls;','Select * from [GasEUR$]')
SELECT * FROM Report_temp
Error: Cannot create an instance of OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)".
The excel document was not created before hand so is it possible to write a stored procedure that creates the excel document and exports data from table Report_temp to that excel.