不能在 64 位 SQL Server 上在進程中加載 32 位 OLE DB 訪問接口“Microsoft.ACE.OLEDB.12.0”。


在64位的機器上安裝64位的 Microsoft.ACE.OLEDB.12.0

http://www.microsoft.com/zh-cn/download/details.aspx?id=13255

 可視化修改導入功能,允許在進程中使用:

 

 

 

 

 

tsql腳本修改導入功能,允許進程內使用,然后執行sql

--開啟導入功能
exec sp_configure 'show advanced options',1
reconfigure
exec sp_configure 'Ad Hoc Distributed Queries',1
reconfigure

--允許在進程中使用ACE.OLEDB.12
EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0', N'AllowInProcess', 1
reconfigure
----允許動態參數
EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0', N'DynamicParameters', 1
reconfigure

select * from OpenDataSource('Microsoft.ACE.OLEDB.12.0', 'Excel 12.0;HDR=Yes;IMEX=1;Database=E:\desktop\_temp\sheet1.xls')...[Sheet4$]
select * from OPENROWSET('Microsoft.ACE.OLEDB.12.0','Excel 12.0;Database=E:\desktop\_temp\sheet1.xls;hdr=yes;imex=1', sheet4$)
select * from OPENROWSET('Microsoft.ACE.OLEDB.12.0','Excel 12.0;Database=E:\desktop\_temp\sheet1.xls;hdr=yes;imex=1', sheet5$)
select * from OPENROWSET('Microsoft.ACE.OLEDB.12.0','Excel 12.0;Database=E:\desktop\_temp\sheet1.xls;hdr=yes;imex=1', sheet6$)

--關閉導入功能
exec sp_configure 'Ad Hoc Distributed Queries',0
reconfigure
exec sp_configure 'show advanced options',0
reconfigure

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM