Home >Database >Mysql Tutorial >How to Enable Ad Hoc Distributed Queries in SQL Server?

How to Enable Ad Hoc Distributed Queries in SQL Server?

Patricia Arquette
Patricia ArquetteOriginal
2024-12-30 01:35:09756browse

How to Enable Ad Hoc Distributed Queries in SQL Server?

Enabling Ad Hoc Distributed Queries in SQL Server

OpenRowset queries that functioned seamlessly in SQL Server 2000 often encounter the following error in SQL Server 2008:

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.

To resolve this error and enable Ad Hoc Distributed Queries, follow these steps using sp_configure:

-- Show advanced server configuration options
EXEC sp_configure 'show advanced options', 1
RECONFIGURE

-- Enable Ad Hoc Distributed Queries
EXEC sp_configure 'ad hoc distributed queries', 1
RECONFIGURE

After executing these commands, Ad Hoc Distributed Queries should be enabled for your SQL Server 2008 instance, allowing OpenRowset queries to run successfully.

The above is the detailed content of How to Enable Ad Hoc Distributed Queries in SQL Server?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn