开发者

SQL Server queries xls file worked yesterday(I swear), now refuses to. 0.o

Hey all, the following select statement used to correctly query an Excel spreadsheet on a 64bit SQL Server 2008 R2, and now provides me with an error.

SELECT 
     MPNCode, Supplier, Stock , Price, Manufacturer, [Description]
FROM 
     OPENROWSET('Microsoft.ACE.O开发者_JAVA百科LEDB.12.0',
    'Excel 12.0 Xml;Database=C:\inetpub\wwwroot\nCompass\Products\Import\SupplierProducts.xls;HDR=YES',
                'SELECT * FROM [Sheet1$]') WHERE MPNCode IS NOT NULL

The error I get is.

OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)" returned message "Unspecified error".

Msg 7303, Level 16, State 1, Line 1 Cannot initialize the data source object of OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)".

I've tried restarting everything and googled the thing to death - somehow something has happened that is preventing this from working.

The file-path/file-name is correct because when I change the path I get a different error message.

Ad-hoc connections are enabled from the surface manager - after this I'm stumped at what the issue could be.

Any help will be very much appreciated.


Is the linked spreadsheet opened on the desktop? What happens if you create a new sheet in the same folder and try to open it instead?


I think SQL Server needs to access to TEMP folders to copy or create some files. If the folder does not exist or ther SQL Service account does not have enough permission to access the folders, you'll get the exception.

Run Procmon.exe on the server and execute the query again. You can see what's happening and where the SQL Server wants to access.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜