注册 登录
编程论坛 SQL Server论坛

SQL疑问

a913221936 发布于 2015-02-09 16:22, 777 次点击
刚接触SQL,想学学如何用SQL语句把Excel表导入数据库,求大神们教教。。
2 回复
#2
mxbing19842015-02-10 08:49
--查询excel2007
select * from OpenDataSource('Microsoft.ACE.OLEDB.12.0', 'Data Source=D:\2007.xlsx;Extended Properties="Excel 12.0;HDR=Yes;IMEX=1"')...[Sheet1$]
--查询excel2003
select * from OpenDataSource( 'Microsoft.Jet.OLEDB.4.0','Data Source="D:\2003.xls";Extended properties=Excel 5.0')...[Sheet1$]  
--如果提示无法创建链接服务器 "(null)" 的 OLE DB 访问接口 "MSDASC" 的实例,解决办法,将sqlserver的登陆改成本地账户
--如果提示SQL Server 阻止了对组件 'Ad Hoc Distributed Queries' 的的访问,解决办法,开启分布式查询
exec sp_configure 'show advanced options',1
reconfigure
exec sp_configure 'Ad Hoc Distributed Queries',1
reconfigure
exec sp_configure 'show advanced options',0
reconfigure
#3
volte2015-02-11 10:33
纯粹的excel导入SQL ,网络上一大片代码。有问题先找度娘,不懂的再问!!
不然自己得不到进步!
1