首页 > 数据库技术 > 详细

sql2008_x64 读取excel

时间:2015-05-12 13:13:11      阅读:273      评论:0      收藏:0      [点我收藏+]

sql2008_x64 读取excel

下载64bit 版的AccessDatabaseEngine_x64:http://www.microsoft.com/en-us/download/details.aspx?id=13255

 

 1 --开启导入功能
 2 exec sp_configure show advanced options,1
 3 reconfigure
 4 exec sp_configure Ad Hoc Distributed Queries,1
 5 reconfigure
 6 --允许在进程中使用ACE.OLEDB.12
 7 EXEC master.dbo.sp_MSset_oledb_prop NMicrosoft.ACE.OLEDB.12.0, NAllowInProcess, 1
 8 --允许动态参数
 9 EXEC master.dbo.sp_MSset_oledb_prop NMicrosoft.ACE.OLEDB.12.0, NDynamicParameters, 1
10 
11 --导入临时表 
12  EXEC (SELECT * FROM OPENROWSET(‘‘Microsoft.ACE.OLEDB.12.0‘‘, ‘‘Excel 12.0;Database=D:\AGS-1249.xlsx;DHR=YES‘‘, ‘‘SELECT * FROM [Sheet1$]‘‘))
13 --select * from opendatasource(Microsoft.Ace.OLEDB.12.0,Data Source=D:/AGS-1249.xlsx;Extended properties=Excel 12.0;hdr=yes;IMEX=1)...[sheet1$]
14 --注意这里,要先关闭外围的设置,然后再关闭高级选项
15 exec sp_configureAd Hoc Distributed Queries,0
16 reconfigure
17 exec sp_configureshow advanced options,0
18 reconfigure
19 --关闭ACE.OLEDB.12的选项
20 EXEC master.dbo.sp_MSset_oledb_prop NMicrosoft.ACE.OLEDB.12.0, NAllowInProcess, 0
21 EXEC master.dbo.sp_MSset_oledb_prop NMicrosoft.ACE.OLEDB.12.0, NDynamicParameters, 0

 

sql2008_x64 读取excel

原文:http://www.cnblogs.com/macavalier/p/4496994.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!