SQL SERVER 2008 64位系统无法导入ACCESS/EXCEL怎么办(sql server 2008如何打开)这都可以?

随心笔谈2年前发布 admin
198 0 0

文章摘要

这篇文章描述了一个SQL Server连接问题的解决过程。主要内容是通过配置SQL Server的高级选项,修复了无法在进程中使用Microsoft.ACE.OLEDB.12连接到外部数据库的问题。操作步骤包括: 1. 启用导入功能并重新配置高级选项; 2. 允许动态参数和使用ACE.OLEDB.12; 3. 导入临时表并完成连接; 4. 关闭相关设置以避免影响后续操作。文章重点突出解决方案的关键点,帮助读者快速理解问题并掌握解决方法。


–开启导入功能
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
–导入临时表
exec (‘insert into jihua(id,[批次号],Right(”’+ @filepath +”’,charindex(”\”,REVERSE(”’+ @filepath +”’))-1),getdate() FROM OPENDATASOURCE (”Microsoft.ACE.OLEDB.12.0”, ”Data Source=’+@filepath+’;User ID=Admin;Password=” )…计划汇总表’)
–注意这里,要先关闭外围的设置,然后再关闭高级选项
exec sp_configure’Ad Hoc Distributed Queries’,0
reconfigure
exec sp_configure’show advanced options’,0
reconfigure
–关闭ACE.OLEDB.12的选项
EXEC master.dbo.sp_MSset_oledb_prop N’Microsoft.ACE.OLEDB.12.0′, N’AllowInProcess’, 0
EXEC master.dbo.sp_MSset_oledb_prop N’Microsoft.ACE.OLEDB.12.0′, N’DynamicParameters’, 0

© 版权声明

相关文章