Question : Load analysis services data into an Access table

I have a cube in SQLAS 2005.   I also have created an MDX statement to query the cube and return data (using pro-clarity).

What I really need to is use MS Access and import the data queried by the MDX.   If there is someway for me to pass the query from Access to SQLAS then this would be ideal.

I can't see how to do this so any help would be well appreciated.

Answer : Load analysis services data into an Access table

I have found a solution, but not easy one... Maybe someone could find a better one...

1. In your SQL Server create linked server pointing to SSAS:

EXEC master.dbo.sp_addlinkedserver @server = N'SSAS', @srvproduct=N'MSOLAP', @provider=N'MSOLAP', @datasrc=N'localhost', @catalog=N'Adventure Works DW 2008'
EXEC master.dbo.sp_addlinkedsrvlogin @rmtsrvname=N'SSAS',@useself=N'True',@locallogin=NULL,@rmtuser=NULL,@rmtpassword=NULL

GO
EXEC master.dbo.sp_serveroption @server=N'SSAS', @optname=N'collation compatible', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'SSAS', @optname=N'data access', @optvalue=N'true'
GO
EXEC master.dbo.sp_serveroption @server=N'SSAS', @optname=N'dist', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'SSAS', @optname=N'pub', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'SSAS', @optname=N'rpc', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'SSAS', @optname=N'rpc out', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'SSAS', @optname=N'sub', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'SSAS', @optname=N'connect timeout', @optvalue=N'0'
GO
EXEC master.dbo.sp_serveroption @server=N'SSAS', @optname=N'collation name', @optvalue=null
GO
EXEC master.dbo.sp_serveroption @server=N'SSAS', @optname=N'lazy schema validation', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'SSAS', @optname=N'query timeout', @optvalue=N'0'
GO
EXEC master.dbo.sp_serveroption @server=N'SSAS', @optname=N'use remote collation', @optvalue=N'true'
GO
EXEC master.dbo.sp_serveroption @server=N'SSAS', @optname=N'remote proc transaction promotion', @optvalue=N'true'
GO

2. Now you can execute a MDX Query via linked server - you use SQL Server connection, not SSAS!

select * from openquery(SSAS,'
SELECT  
      {Measures.[Internet Sales Amount]} ON COLUMNS,
      [Date].[Month].members ON ROWS
    FROM [Adventure Works]
')

3. Create a view in one of databases in your SQL Server. Copy query to view definition.
View is necessary because Access imports tables and views via ODBC source. I haven't found place to enter SQL query.

USE [MDW]
GO

CREATE VIEW [dbo].[v_MDX]
AS
SELECT     [[Date]].[Calendar]].[Calendar Year]].[MEMBER_CAPTION]]] AS Cyear, [[Date]].[Calendar]].[Calendar Semester]].[MEMBER_CAPTION]]] AS CSemester,
                      [[Date]].[Calendar]].[Calendar Quarter]].[MEMBER_CAPTION]]] AS CQuarter, [[Date]].[Calendar]].[Month]].[MEMBER_CAPTION]]] AS CMonth,
                      [[Measures]].[Internet Sales Amount]]] AS Amount
FROM         OPENQUERY(SSAS, '
SELECT  
      {Measures.[Internet Sales Amount]} ON COLUMNS,
      [Date].[Month].members ON ROWS
    FROM [Adventure Works]
')
                      AS derivedtbl_1

You must alias each column returned by a view, because Access won't allow [[Date]].[Calendar]].[Calendar Year]].[MEMBER_CAPTION]]] as column name. Enter aliases in the view definition.

4. Create ODBC Connection in Access. You provide driver - SQL Server Native Client, server name. You must remember to enter your SQL Server database (this one with the view) as default one.

5. When you import data from ODBC Source you have to pick a table or a view from list. You should see your view in it. Next you can save import definition.

Another way is to use SSIS to transfer data from SSAS to Access database. Of course you must use linked server to SSAS, and connect to SQL Server connection. Then you can use query from pt. 2.

HTH

best regards


Random Solutions  
 
programming4us programming4us