Excel 到 sql table 错误消息 7350
Excel to sql table error Msg 7350
我正在使用此代码将 excel 文件导入 sql table
USE master
GO
sp_configure 'show advanced options', 1;
RECONFIGURE;
GO
sp_configure 'Ad Hoc Distributed Queries', 1;
RECONFIGURE;
GO
insert into memberform (id)
SELECT * FROM OPENROWSET ('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=C:\test.xls;HDR=YES', 'select * from [Sheet1$]')
但我收到错误消息:
Msg 7350, Level 16, State 2, Line 1
Cannot get the column information from OLE DB provider "Microsoft.Jet.OLEDB.4.0" >for linked server "(null)".
在 sql 中有什么我应该首先参数化的吗?
基本上,由于安全配置,Ad hoc Distributed Queries
在 SQL 服务器中默认禁用,您不能使用 OPENROWSET
或 OPENDATASOURCE
,如果您无法执行这些行集功能,则您无法访问任何远程数据源。
运行 启用这些选项的以下查询让您可以在没有任何进一步问题的情况下处理这些选项:
USE master
GO
sp_configure 'show advanced options', 1;
RECONFIGURE;
GO
sp_configure 'Ad Hoc Distributed Queries', 1;
RECONFIGURE;
GO
从输出中,您可以看到 "Ad hoc Distributed Queries" 设置从 0 更改为 1。现在您可以轻松执行任何 Ad hoc Query
注意:默认情况下,此选项设置为0,您需要将其更改为1才能激活此功能。
希望对您有所帮助!
我找到了解决方案,我刚刚安装了 AccessDatabaseEngine_X64 位。因为我的 sql 是 64 位的,而我的 office 是 32 位的,所以它没有 worked.The 问题是您无法在 office 2007 32 位上安装 Access Database Engine x64。您将需要此说明:https://knowledge.autodesk.com/support/autocad-civil-3d/troubleshooting/caas/sfdcarticles/sfdcarticles/How-to-install-64-bit-Microsoft-Database-Drivers-alongside-32-bit-Microsoft-Office.html
同样在我的代码中,我应该使用 jet.Also 的 ace,因为我使用的是 excel 2007,我需要将其更改为 excel 12.0。像下面的例子
SELECT * FROM OPENROWSET ('Microsoft.Ace.OLEDB.12.0', 'Excel 12.0;Database=C:\test.xlsx;HDR=YES', 'select * from [Sheet1$]')
我正在使用此代码将 excel 文件导入 sql table
USE master
GO
sp_configure 'show advanced options', 1;
RECONFIGURE;
GO
sp_configure 'Ad Hoc Distributed Queries', 1;
RECONFIGURE;
GO
insert into memberform (id)
SELECT * FROM OPENROWSET ('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=C:\test.xls;HDR=YES', 'select * from [Sheet1$]')
但我收到错误消息:
Msg 7350, Level 16, State 2, Line 1 Cannot get the column information from OLE DB provider "Microsoft.Jet.OLEDB.4.0" >for linked server "(null)".
在 sql 中有什么我应该首先参数化的吗?
基本上,由于安全配置,Ad hoc Distributed Queries
在 SQL 服务器中默认禁用,您不能使用 OPENROWSET
或 OPENDATASOURCE
,如果您无法执行这些行集功能,则您无法访问任何远程数据源。
运行 启用这些选项的以下查询让您可以在没有任何进一步问题的情况下处理这些选项:
USE master
GO
sp_configure 'show advanced options', 1;
RECONFIGURE;
GO
sp_configure 'Ad Hoc Distributed Queries', 1;
RECONFIGURE;
GO
从输出中,您可以看到 "Ad hoc Distributed Queries" 设置从 0 更改为 1。现在您可以轻松执行任何 Ad hoc Query
注意:默认情况下,此选项设置为0,您需要将其更改为1才能激活此功能。
希望对您有所帮助!
我找到了解决方案,我刚刚安装了 AccessDatabaseEngine_X64 位。因为我的 sql 是 64 位的,而我的 office 是 32 位的,所以它没有 worked.The 问题是您无法在 office 2007 32 位上安装 Access Database Engine x64。您将需要此说明:https://knowledge.autodesk.com/support/autocad-civil-3d/troubleshooting/caas/sfdcarticles/sfdcarticles/How-to-install-64-bit-Microsoft-Database-Drivers-alongside-32-bit-Microsoft-Office.html
同样在我的代码中,我应该使用 jet.Also 的 ace,因为我使用的是 excel 2007,我需要将其更改为 excel 12.0。像下面的例子
SELECT * FROM OPENROWSET ('Microsoft.Ace.OLEDB.12.0', 'Excel 12.0;Database=C:\test.xlsx;HDR=YES', 'select * from [Sheet1$]')