Solved

MS SQL openrowset function

Posted on 2015-02-03
5
118 Views
Last Modified: 2015-02-07
I tried to run this command, and am getting the error message. How can I solve it
INSERT INTO OPENROWSET('Microsoft.ACE.OLEDB.12.0',
'Excel 12.0;Database=C:\autre\testing.xls;',
'SELECT * FROM [Sheet1$]')
SELECT * FROM dbo.contract Where PROJECTID=160

Msg 15281, Level 16, State 1, Line 1
SQL Server blocked access to STATEMENT 'OpenRowset/OpenDatasource' of component 'Ad Hoc Distributed Queries' because this component is turned off as part of the security configuration for this server.
 A system administrator can enable the use of 'Ad Hoc Distributed Queries' by using sp_configure.
0
Comment
Question by:Omer-Pitou
  • 2
  • 2
5 Comments
 
LVL 12

Accepted Solution

by:
Habib Pourfard earned 250 total points
ID: 40587265
try this:
sp_configure 'show advanced options', 1;
RECONFIGURE;
sp_configure 'Ad Hoc Distributed Queries', 1;
RECONFIGURE;

Open in new window

0
 

Author Comment

by:Omer-Pitou
ID: 40587362
The configuration works perfectly. But, now i am getting this error message
Cannot create an instance of OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)".
0
 
LVL 75

Assisted Solution

by:Aneesh Retnakaran
Aneesh Retnakaran earned 250 total points
ID: 40587490
Seems like the sql server machine is missing "Microsoft Access Database Engine 2010 Redistributable”
0
 

Author Comment

by:Omer-Pitou
ID: 40588940
Am I right by saying that the number 12  in "Microsoft.ACE.OLEDB.12.0" refers to 2010 version of this engine?
What If I have access 2013 installed on my computer, what you will be the version number of the engine?
0
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 40589017
>Am I right by saying that the number 12  in "Microsoft.ACE.OLEDB.12.0" refers to 2010 version of this engine?
Yup , you can download it from here https://www.microsoft.com/en-ca/download/details.aspx?id=13255 

>What If I have access 2013 installed on my computer, what you will be the version number of the engine
2013 is 14.0 ;
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question