Excle导入SQL数据库问题

目的 : sql2008 读取 excel

环境  :sql2008 win7 excel(版本不详)

执行 : SELECT *   FROM OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
          'Data Source="c:/ebilling.xls";Extended properties=Excel 5.0')...sheet1$

显示错误:链接服务器"(null)"的 OLE DB 访问接口 "Microsoft.Jet.OLEDB.4.0" 返回了消息 "未指定的错误"。
             消息 7303,级别 16,状态 1,第 1 行
             无法初始化链接服务器 "(null)" 的 OLE DB 访问接口 "Microsoft.Jet.OLEDB.4.0" 的数据源对象。

 

解决方法:

1.启用Ad Hoc Distributed Queries

--启用Ad Hoc Distributed Queries:

exec sp_configure "show advanced options",1

reconfigure

exec sp_configure "Ad Hoc Distributed Queries",1

reconfigure

--使用完成后,关闭Ad Hoc Distributed Queries:

exec sp_configure "Ad Hoc Distributed Queries",0

reconfigure

exec sp_configure "show advanced options",0

reconfigure
2.执行语句修改为 :SELECT * FROM OpenDataSource( 'Microsoft.ACE.OLEDB.12.0','Data Source=c:/ebilling.xls;Extended properties=Excel 8.0')...Sheet1$
参考原文:
无法初始化链接服务器 "(null)" 的 OLE DB 访问接口 "Microsoft.Jet.OLEDB.4.0" 的数据源


<div class="postBody">
<p><strong>问题:</strong>
在SQL服务器上用sa账号登陆后执行</p><pre name="code" class=" sql">SELECT * FROM OpenDataSource( "Microsoft.Jet.OLEDB.4.0","Data Source="d:/a.xls";User ID=Admin;Password=;Extended properties=Excel 8.0")...[Sheet1$]


提示:
链接服务器"(null)"的 OLE DB 访问接口 "Microsoft.Jet.OLEDB.4.0" 返回了消息 "未指定的错误"。
消息 7303,级别 16,状态 1,第 1 行
无法初始化链接服务器 "(null)" 的 OLE DB 访问接口 "Microsoft.Jet.OLEDB.4.0" 的数据源对象。
此语句以前正常。大约1周前出现上述问题,我们查阅了大量的资料都无法解决,请高手赐教


解决:

1、文件是不是加密码了
2、xls要关闭,不能打开
3、是否允许OPENDATASOURCE 支持
4、你是2005 还是2000?

5.启用Ad Hoc Distributed Queries

--启用Ad Hoc Distributed Queries:

exec sp_configure "show advanced options",1

reconfigure

exec sp_configure "Ad Hoc Distributed Queries",1

reconfigure

--使用完成后,关闭Ad Hoc Distributed Queries:

exec sp_configure "Ad Hoc Distributed Queries",0

reconfigure

exec sp_configure "show advanced options",0

reconfigure
<strong>问题:</strong>
<strong>尚未注册 OLE DB 访问接口 "Microsoft.ACE.OLEDB.12.0"。 </strong>
<strong></strong>
<pre name="code" class=" sql"><strong>解决:</strong>
<strong>安装office2010 且需安装另一款组件。</strong>
 
 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值