当你的才华不能撑起你的野心时,就是你该选择学习的时候了!

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

 

posted @ 2020-03-06 19:52  hofmann  阅读(2093)  评论(0编辑  收藏  举报