Ad Hoc Distributed Queries

Ad hoc distributed queries use the OPENROWSET and OPENDATASOURCE functions to connect to remote data sources that use OLE DB. For more information about enabling ‘Ad Hoc Distributed Queries’, search for ‘Ad Hoc Distributed Queries’ in SQL Server Books Online.

As the word "ad hoc" suggests, this type of query is designed for a "particular purpose,"which is in contrast to a predefined query, which has the same output value on every execution. Ad hoc distributed queries use the OPENROWSET and OPENDATASOURCE functions to connect to remote data sources that use OLE DB.

Ad hoc distributed queries use the OPENROWSET and OPENDATASOURCE functions to connect to remote data sources that use OLE DB.特设分布式查询使用OPENROWSET和OPENDATASOURCE函数连接到远程数据源,使用OLE DB。 OPENROWSET and OPENDATASOURCE should be used only to reference OLE DB data sources that are accessed infrequently. An ad hoc query does not reside in the system for a long time and is created dynamically on demand by the user. Techopedia explains Ad Hoc Query. OPENROWSET et OPENDATASOURCE doivent être utilisés uniquement pour faire référence à des sources de données OLE DB faisant l'objet d'accès peu fréquents. Las funciones OPENROWSET y OPENDATASOURCE solo se deben utilizar para hacer referencia a orígenes de datos OLE DB a los que rara vez se obtiene acceso.

A system administrator can enable the use of ‘Ad Hoc Distributed Queries’ by using sp_configure.