不能在 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