Ad Hoc Distributed Queries Option

By default, SQL Server does not allow ad hoc distributed queries using OPENROWSET and OPENDATASOURCE. When this option is set to 1, SQL Server allows ad hoc access. When this option is not set or is set to 0, SQL Server does not allow ad hoc access.

Ad hoc distributed queries use the OPENROWSET and OPENDATASOURCE functions to connect to remote data sources that use OLE DB. OPENROWSET and OPENDATASOURCE should be used only to reference OLE DB data sources that are accessed infrequently. For any data sources that will be accessed more than several times, define a linked server.,SQL.90).gifSecurity Note:
Enabling the use of ad hoc names means that any authenticated login to SQL Server 2005 can access the provider. SQL Server administrators should enable this feature for providers that are safe to be accessed by any local login. For more information, see the DisallowAdhocAccess option in Accessing External Data.

See Also


Setting Server Configuration Options
Accessing External Data
Linking Servers

Other Resources

sp_addlinkedserver (Transact-SQL)

Help and Information

Getting SQL Server 2005 Assistance

Change History

Release History

12 December 2006

Changed content:
  • Changed values that can be set for this option to be consistent with default values.

14 April 2006

Changed content:
  • Clarified the values that can be set for this option, and what these values mean.