Export (0) Print
Expand All

OPENQUERY (DMX)

Topic Status: Some information in this topic is preview and subject to change in future releases. Preview information describes new features or changes to existing features in Microsoft SQL Server 2016 Community Technology Preview 2 (CTP2).

Replaces the source data query with a query to an existing data source. The INSERT, SELECT FROM PREDICTION JOIN, and SELECT FROM NATURAL PREDICTION JOIN statements support OPENQUERY.

OPENQUERY(<named datasource>, <query syntax>)

named datasource

A data source that exists on the Microsoft SQL Server Analysis Services database.

query syntax

A query syntax that returns a rowset.

OPENQUERY provides a more secure way to access external data by supporting data source permissions. Because the connection string is stored in the data source, administrators can use the properties of the data source to manage access to the data. For more information about data sources, see Supported Data Source Types (SSAS Multidimensional).

You can get a list of the data sources that are available on a server by querying the MDSCHEMA_INPUT_DATASOURCES schema rowset. For more information about using MDSCHEMA_INPUT_DATASOURCES, see MDSCHEMA_INPUT_DATASOURCES Rowset.

You can also return a list of data sources in the current Analysis Services database by using the following DMX query:

SELECT * FROM $system.MDSCHEMA_INPUT_DATASOURCES

The following example uses the MyDS data source already defined in the Analysis Services database to create a connection to the AdventureWorksDW2012 database and query the vTargetMail view.

OPENQUERY (MyDS,'SELECT TOP 1000 * FROM vTargetMail')
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2015 Microsoft