我正在使用Excel 2010和sql server 2008将数据从excel导入到sql server。但我没有成功。你能检查一下我在做什么吗?将Excel 2010导入到Sql Server 2008中
sp_CONFIGURE 'show advanced options',1
RECONFIGURE
GO
sp_CONFIGURE 'optimize for ad hoc workloads',1
RECONFIGURE
GO
sp_configure 'Ad Hoc Distributed Queries', 1
GO
RECONFIGURE
SELECT * FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0','Excel 12.0;Database=C:\Users\anayak\AppData\Roaming\Microsoft\Templates\Book1.xlsx; HDR=YES;IMEX=1','SELECT * FROM [sheet1$]');
我在哪里得到这个错误
OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)" returned message "Unspecified error".
Msg 7303, Level 16, State 1, Line 1
Cannot initialize the data source object of OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)".
我安装了Microsoft Access数据库引擎2010可再发行的Microsoft.ACE.OLEDB.12.0。
但是,当我使用命令“ODBCAD32.EXE”来检查我的Excel的版本,然后我得到14.00.4760.1000。
然后我想我的连接字符串 -
SELECT * FROM OPENROWSET('Microsoft.ACE.OLEDB.14.0','Excel 14.0;Database=C:\Users\anayak\AppData\Roaming\Microsoft\Templates\Book1.xlsx; HDR=YES;IMEX=1','SELECT * FROM [sheet1$]');
但同样没有工作。
你可以请你建议我在这里做错了吗?
谢谢。
请提供您使用的操作系统名称 – 2013-04-24 10:33:50
Windows 7 32位和SQL Server 2008 32位.. – abhijith 2013-04-24 10:34:52
尝试关闭UAC。 – 2013-04-24 10:35:46