EDUDOTNET

Monday, October 17, 2016

SQL Server blocked access to STATEMENT 'OpenRowset/OpenDatasource' of component 'Ad Hoc Distributed Queries'

When I try to run query with "SELECT * FROM OPENROWSET" than I`m getting error:

"Msg 15281, Level 16, State 1, Procedure GetUserData, Line 10
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. For more information about enabling 'Ad Hoc Distributed Queries', search for 'Ad Hoc Distributed Queries' in SQL Server Books Online.
"

How to make enable Ad Hoc Distributed Queries sql server 2012?

You can enable "Ad Hoc Distributed Queries" using following command:

EXEC sp_configure 'show advanced options', 1
RECONFIGURE

GO

EXEC sp_configure 'ad hoc distributed queries', 1
RECONFIGURE

GO


 After run the command you get the successful message :

Configuration option 'show advanced options' changed from 0 to 1. Run the RECONFIGURE statement to install.
Configuration option 'Ad Hoc Distributed Queries' changed from 0 to 1. Run the RECONFIGURE statement to install.

 
 

0 comments:

Post a Comment