开发者

Sql Server 2000 openrowset issue

I’m attempting to query and Excel spread sheet on a network share, using the openrowset function with no success. I get the following error:

SELECT * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0', 
    'Excel 8.0;DATABASE=\\server\Xdrive:\Spreadsheet.xls',
    'Select * from [Sheet1$]')

Server: Msg 7399, Level 16, State 1, Line 1

OLE DB provider 'Microsoft.Jet.OLEDB.4.0' reported an error. The provider did not give any information about the error.

OLE DB error trace [OLE/DB Provider 'Microsoft.Jet.OLEDB.4.0' IDBInitialize::Initialize returned 0x80004005: The provider did not give any information about the error.].

I have s开发者_如何学Goearched the site and have tried different syntax with no success. I have read that the account may not have access to the network share. What account does this process run under?


0x80004005 very much looks like Access Denied.

You can look in the services.msc what account the SQL Server runs under. A local account will not work outside of the local machine, a Domain account is the better choice if you want to access resources on the network.

An exception is the NetworkService account (available on Windows 2003 and higher). It is a local account that can access the network, it acts as the machine account (DomainName\MachineName$) in this case. I would recommend a dedicated domain account nevertheless.


I would use network share but not mapped drives since I always thought that they are creating sessions per each user.

It would not cause access error but you probably should specify that the first row of sheet be not skipped by reading headers:

  • SELECT * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
    'Excel 8.0;DATABASE=\server\ Xdrive: \Spreadsheet.xls ;HDR=NO',
    'Select * from [Sheet1$]')
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜