Click here to Skip to main content
13,148,427 members (63,081 online)
Rate this:
Please Sign up or sign in to vote.
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;',

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[^]

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
Posted 28-Mar-13 21:16pm
Maciej Los 29-Mar-13 3:34am
We need more information:
- does sql server is installed locally (enables network connections?) or in network?
- does machine is on 32/64 bit OS?
- does sql server is on 32/64 bit OS?
deepakdynamite 29-Mar-13 4:11am
sql server is installed on another server. and i am connected using management studio.
My machine is 34 bit OS
Maciej Los 29-Mar-13 4:38am
...and server: 32 or 64 bit version?
deepakdynamite 29-Mar-13 9:09am
Thanks Alot.... Your Question itself solved my problem..

The reason of failure was as under :

I was connected through remote machine and server didn't have excel file on path. Conclusion is path provided should be of server file directory

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.170924.2 | Last Updated 29 Mar 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100