EXEC
@server = N'AM_OLAP', -- name of linked server
@srvproduct=N'MSOLAP',
@provider=N'MSOLAP', -- see list of providers avaoilable on SQL Server under Linked Server > Prover node in SSMS Object Browser
@datasrc=N'MyOlapServer', -- machine that host Analysis Services
@catalog=N'MyOlapDatabase' -- Analysis Services database (cube)
If database server and Analysis Services are on different machines, queries executed through it may have a problem with "double hop" (fact that security context cannot be trasfered from one server to the other):
To resolve that problem you have 3 options:
1. Run SQL queries from data server (you need to be remotly connected to the database server)
2. Enable use of Kerberos on the database server
3. Set proxy account for linked server, so that MDX queries are executed in its context instead of in context of the user that is issuing t-sql query:
EXECmaster.dbo.sp_addlinkedsrvlogin @rmtsrvname=N'AM_OLAP',@useself=N'False',@locallogin=NULL,@rmtuser=N'myDomain\MyLogin',@rmtpassword='########'
Now you may be able to use it in queries like this:
Select * From OpenQuery(AM_OLAP, 'mdx query')