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

随心笔谈12个月前发布 admin
93 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
–导入临时表
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

© 版权声明

相关文章