views:

45

answers:

2

Hi, I have a problem with this query:

UPDATE Provinces 
SET    Provinces.DefaultName=T2.Defaultname 
FROM   Provinces 
INNER JOIN 
    OPENROWSET('Microsoft.Jet.OLEDB.4.0',
               'Excel 8.0;Database=C:\provinces.xlsx;HDR=YES',
               'SELECT Code, Defaultname FROM [Arkusz1$]') T2 
     On Provinces.Code = t2.Code 
WHERE  Provinces.Code = T2.Code

I get 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)".

What is the source of this error, and how can I modify the SQL statement?

+1  A: 

There are several possible causes of this detailed here: Linked Server using Microsoft.Jet.OLEDB.4.0 problem.

A likely is cause is file system permissions of the temp directory for the sql service login for whoever is accessing that linked server: C:\Documents and Settings\(sql login name)\Local Settings\Temp

Mitch Wheat
A: 

That is permission denied error. Follow:

How to import data from Excel to SQL Server

How to use Excel with SQL Server linked servers and distributed queries

Note If you are using SQL Server 2005, make sure that you have enabled the Ad Hoc Distributed Queries option by using SQL Server Surface Area Configuration.

sp_configure 'Ad Hoc Distributed Queries', 1
volody