Hello Everyone,
I am using following query to export output of query to an excel file.
insert into OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=C:\Projects\Book1.xls;',
'select * from [sheet1$]') SELECT N_APP_DESCRIPTION FROM N_APP_APPLICATION
Here i am trying to export only one field of table in Excel sheet. But it comes up with following error.
Msg 7399, Level 16, State 1, Line 1
The OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)" reported an error. The provider did not give any information about the error.
Msg 7303, Level 16, State 1, Line 1
Cannot initialize the data source object of OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)".
I have gone through several links where it says to make sure file name is correct and i ensure that file name is correct.
I have used following link to do this
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=49926[
^]
Create an Excel file named testing having the headers same as that of table columns and use these queries
1 Export data to existing EXCEL file from SQL Server table
insert into OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=D:\testing.xls;',
'SELECT * FROM [SheetName$]') select * from SQLServerTable
As said in link i have created "N_APP_DESCRIPTION" column in excel sheet i.e on sheet1
Please help me if you can
Thanks alot