在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