Excel 2003 数据导入到 SQL Server

insert into 课程(课程编号,课程名称,学分,讲授学时,实验学时,实践学时)
select * from OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0',
'Data Source=D:\kc.xls;Extended Properties=Excel 8.0')...[Sheet1$]

可能出现原错误1:

SQL Server 阻止了对组件 'Ad Hoc Distributed Queries' 的 STATEMENT'OpenRowset/OpenDatasource' 的访问,因为此组件已作为此服务器安全配置的一部分而被关闭

解决办法:

exec sp_configure 'show advanced options',1
reconfigure
exec sp_configure 'Ad Hoc Distributed Queries',1
reconfigure

可能出现原错误2:链接服务器 "(null)" 的 OLE DB 访问接口 "Microsoft.Jet.OLEDB.4.0" 不包含表 "Sheet1$"。该表不存在,或者当前用户没有访问该表的权限。

原因:

看看你现在操作的数据库是否存在这个表

远程登录?

posted on 2011-03-20 12:05  Allan GC  阅读(292)  评论(0编辑  收藏  举报

导航