Using MSOLAP as a linked server

I just faced the problem to connect an Analysis Services (2000 or 2005) to a SQL Server 2005 database using a OPENROWSET statement. If you face an “access denied” error (precisely, “The OLE DB provider “MSOLAP” for linked server “SERVERNAME” reported an error. Access denied.”) the solution is to enable the “Allow inprocess” flag in MSOLAP Provider Options.

You can modify provider option through SQL Server Management Studio, Server Objects / Linked Servers / Providers / MSOLAP, right-click and edit Properties.

When you get a result for an MDX query, the resulting column names are composed by dimension+levels+property name, so if you would like a cleaner naming you can use the WITH statement to define column names in a fast way. E.G.

WITH A (Customer, Product, Year, Sales )
SELECT * FROM OPENROWSET( ‘MSOLAP’, ‘DATASOURCE=localhost; Initial Catalog=FoodMart 2000;’,
‘…[place here your MDX query]…’ )