我試圖運作以下查詢:
SELECT * FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0','Excel 12.0;Database=C:\Somefile.xlsx','SELECT * FROM [Sheet$]')
但我得到這個錯誤:
Cannot initialize the data source object of OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)".
我嘗試了以下方法:
sp_configure 'show advanced options',1;
RECONFIGURE;
sp_configure 'Ad Hoc Distributed Queries',1;
RECONFIGURE;
GO
和:
USE [master]
GO
EXEC master . dbo. sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0',N'AllowInProcess',1
GO
EXEC master . dbo. sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0',N'DynamicParameters',1
GO
當我轉到’伺服器對象’時 – > ‘連結伺服器’ – > ‘Providers’,Microsoft.ACE.OLEDB.12.0已列出.
安裝了Acess Database Engine x64,所有Office産品都是64位,我的sql Server也是64位.
如果重要,所有使用者都可以通路Users檔案夾中的Temp檔案夾.
(這些都是我在這個問題的類似答案中找到的建議)
編輯:使用sql Server 2014.