关于SqlServer访问Excel数据及导入导出问题
电脑环境:Win7,SQL Server 2014 Express,Office2016(包含 Microsoft.ACE.OLEDB.15.0){如果安装Office2010则包含 Microsoft.ACE.OLEDB.12.0}
--开启导入功能
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
--允许动态参数
EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0', N'DynamicParameters', 1
--允许在进程中使用ACE.OLEDB.15
EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.15.0', N'AllowInProcess', 1
--允许动态参数
EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.15.0', N'DynamicParameters', 1
--关闭Ad Hoc Distributed Queries的方法(使用完毕后,记得一定要要关闭它,因为这是一个安全隐患,切记执行下面的SQL语句)
exec sp_configure 'Ad Hoc Distributed Queries',0
reconfigure
exec sp_configure 'show advanced options',0
reconfigure
SQL Server 2014读取EXCEL数据时,可能会报这个错误:无法初始化链接服务器“(null)”的 OLE DB 访问接口“Microsoft.ACE.OLEDB.15.0”的数据源对象。
本内容试读结束,登录后可阅读更多
下载后可阅读完整内容,剩余1页未读,立即下载