Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Can't Fix OpenrowSet Error

Author  Topic 

Grifter
Constraint Violating Yak Guru

274 Posts

Posted - 2011-09-05 : 05:27:25
Hi

I am just this minute learning about querying data in an excel sheet from sql query. I have picked up instructions from people doing similar exercises and have tried what I think is the correct syntax and I think I have the correct settings too.

I am on a local database and seem to have the Microsoft.ACE.OLEDB.12.0 linked server that is recommended to use.

I have also tried running the following commands and also restarting SQL Server 2008 to no avail.


USE [master]
GO
sp_configure 'show advanced options',1
GO
reconfigure with override
GO
sp_configure 'Ad Hoc Distributed Queries',1
GO
reconfigure with override
GO


EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0', N'AllowInProcess', 1
GO
EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0', N'DynamicParameters', 1
GO


This is the query I am using:


SELECT *
FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0',
'Excel 12.0;Database=C:\extract1.xlsx;HDR=YES',
'SELECT * FROM [Sheet1$]')


Basically I am new to this and still wondering what some of the syntax means so some things in my query are assumptions, like I do not know what HDR=YES means for example but have left that as is copied from examples I have found.

Current error I have is:

quote:
Msg 7302, Level 16, State 1, Line 1
Cannot create an instance of OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)".



visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-09-05 : 06:27:24
see
http://social.msdn.microsoft.com/Forums/en-US/sqldataaccess/thread/bb2dc720-f8f9-4b93-b5d1-cfb4f8a8b1cb/

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

Grifter
Constraint Violating Yak Guru

274 Posts

Posted - 2011-09-05 : 06:58:18
quote:
Originally posted by visakh16

see
http://social.msdn.microsoft.com/Forums/en-US/sqldataaccess/thread/bb2dc720-f8f9-4b93-b5d1-cfb4f8a8b1cb/




Hi

I have already went through this and tried the solutions.

G
Go to Top of Page

Grifter
Constraint Violating Yak Guru

274 Posts

Posted - 2011-09-05 : 09:37:23
I used ssis instead and that worked ok. Here's a link to help using it if anyone needs it:

http://www.accelebrate.com/sql_training/ssis_2008_tutorial.htm
Go to Top of Page

gwilson67
Starting Member

42 Posts

Posted - 2011-09-05 : 11:31:21
Thanks for the link and the solution.

Greg
http://www.freewebstore.org/tsqlcoderepository
Powerful tool for SQL Server development
Go to Top of Page
   

- Advertisement -