从一个excel文件中查询数据:select * from OPENROWSET('MICROSOFT.JET.OLEDB.4.0','Excel 5.0;HDR=YES;DATABASE=c:\abc.xls',[abc$])出错:伺服器: 訊息 7314,層級 16,狀態 1,行 1
OLE DB provider 'MICROSOFT.JET.OLEDB.4.0' does not contain table 'abc$'. The table either does not exist or the current user does not have permissions on that table.
OLE DB error trace [Non-interface error: OLE DB provider does not contain the table: ProviderName='MICROSOFT.JET.OLEDB.4.0', TableName='abc$'].
OLE DB provider 'MICROSOFT.JET.OLEDB.4.0' does not contain table 'abc$'. The table either does not exist or the current user does not have permissions on that table.
OLE DB error trace [Non-interface error: OLE DB provider does not contain the table: ProviderName='MICROSOFT.JET.OLEDB.4.0', TableName='abc$'].
-----------------
有的,打开abc.xls后在excel的左下角有个abc名称,不是sheet1.
SELECT *
FROM OpenDataSource( 'Microsoft.Jet.OLEDB.4.0','Data Source="c:\abc.xls";User ID=Admin;Password=;Extended properties=Excel 8.0')...[abc$]
SELECT *
FROM OpenDataSource( 'Microsoft.Jet.OLEDB.4.0','Data Source="c:\abc.xls";User ID=Admin;Password=;Extended properties=Excel 8.0')...[abc$]
--------------------------------------------------------------------------------
也出错:伺服器: 訊息 7314,層級 16,狀態 1,行 1
OLE DB provider 'Microsoft.Jet.OLEDB.4.0' does not contain table 'abc$'. The table either does not exist or the current user does not have permissions on that table.
OLE DB error trace [Non-interface error: OLE DB provider does not contain the table: ProviderName='Microsoft.Jet.OLEDB.4.0', TableName='abc$'].郁闷啊!
---------------------------------------------------------------------怎样才知道有没有装oledb4.0版本?我不知道哦。