If you are using Microsoft® SQL Server™ as your database management system, you can use the system stored procedure sp_addlinkedserver to add a linked OLAP server. This action enables you to execute distributed queries against OLE DB data sources that are connected to the linked OLAP server.
You can use the OPENQUERY function within a SQL Server SELECT statement to pass queries to the linked OLAP server. The passed query, which is the second argument of the OPENQUERY function, is limited to the abbreviated SELECT syntax supported by OLAP Services but can include MDX syntax. A passed query that includes MDX returns “flattened rowsets” as described in the OLE DB documentation. For more information about the SELECT syntax supported by SQL Server OLAP Services, see Supported SQL SELECT Syntax.
For this use, the syntax is more specific than that provided in the SQL Server documentation. Note the required program ID MSOLAP.
sp_addlinkedserver @server = 'server', @srvproduct = 'product_name',
@provider = 'MSOLAP', @datasrc = 'data_source',
@catalog = 'catalog'
EXEC sp_addlinkedserver
@server='olap_server',
@srvproduct='',
@provider='MSOLAP',
@datasrc='server',
@catalog='foodmart'
SELECT * FROM OPENQUERY(olap_server,
'SELECT [customer], [quantity] FROM sales')