我正在尝试将此 Excel 工作表放入表格中,以便我可以对其应用选择语句等,以使用其信息更新表格。
SELECT *
FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=C:\PB.xlsx',
'SELECT * FROM [Sheet1$]')
我正在运行 64 位机器。 不知道它是什么 Excel 版本。
错误:
Msg 7399, Level 16, State 1, Line 1 The OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)" reported an error. The provider did not give any information about the error. Msg 7303, Level 16, State 1, Line 1 Cannot initialize the data source object of OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)".
当我更改为 Excel 12.0 时;
OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)" returned message "Could not find installable ISAM.". Msg 7303, Level 16, State 1, Line 1 Cannot initialize the data source object of OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)".
最佳答案
对于 xlsx 文件 (Excel 2007-2010),您可以使用 ACE oledb 提供程序而不是 JET
SELECT *
FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0',
'Excel 12.0;HDR=YES;Database=C:\PB.xlsx',
'SELECT * FROM [Sheet1$]');
关于sql - 使用脚本将 Excel 工作表放入临时表中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12090555/