![](/img/trans.png)
[英]Not all rows are imported from Excel file using OPENROWSET in SQL Server
[英]Importing Excel File from Sharepoint using SQL Openrowset
我正在尝试在我们的 SQL 服务器 2012 上使用 T-SQL/SSMS 导入 excel 文件,使用以下语法:
SELECT * FROM OPENROWSET ('Microsoft.ACE.OLEDB.12.0','Excel 12.0;
Database=//MyCompanyName.sharepoint.com/sites/MySharePointSiteName/Shared Documents/Report.xlsx',
'SELECT * FROM [form1$]' )
我收到(通用)7399/7303 消息:
Msg 7399, Level 16, State 1, Line 9
The OLE DB provider "MICROSOFT.ACE.OLEDB.12.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 9
Cannot initialize the data source object of OLE DB provider "MICROSOFT.ACE.OLEDB.12.0" for linked
server "(null)".
任何想法为什么这会失败? 我们通常不会遇到使用 OPENROWSET 导入本地/网络文件的问题。 有没有人为此目的成功地使用了 OPENROWSET 操作?
这是我到目前为止所尝试的:
1) 确保 SQL 服务帐户设置为我的 Windows 登录(并重新启动) 2) 确保 OPENROWSET 配置正确 3) 确保站点/路径可访问 4) 用引号括起来
这听起来像是一个权限问题。 你能运行这个吗?
USE [master]
GO
EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0', N'DisallowAdHocAccess', 0
GO
USE [master]
GO
EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0', N'AllowInProcess', 1
GO
EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0', N'DynamicParameters', 1
GO
另外,您可以尝试像这样设置您的权限吗?
检查下方的链接。
我猜它应该在那之后工作。 尝试这些想法和反馈。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.