?
Solved

Mdx Queries on Stored Procedure

Posted on 2001-07-10
7
Medium Priority
?
1,837 Views
Last Modified: 2012-06-27
hello,
   I wonder if i could call a queries to OLAP cube
from stored procedure ?
Can someone show me the example ?
0
Comment
Question by:g_temp
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
7 Comments
 
LVL 1

Expert Comment

by:SYASSIN
ID: 6284183
As far as I know this is a mixed answer... Yes if you want to run a store procedures with a parameter, no if you need to add a parameter.  The reason being that you would have to embed the mdx into an openrowset query.  Here is an example:


CREATE PROCEDURE procedurename
as
select * from
openrowset(
'msolap', 'Datasource=SERVERNAME ; USER ID=; PASSWORD=; Initial Catalog=LIBRARY NAME;',
'PLACE MDX Statement here')

If anyone knows a way to make parametrized mdx stored procedure, I would love to know!!!!

Sultan
0
 
LVL 1

Expert Comment

by:SYASSIN
ID: 6284195
oops... the answer above should read:


Yes if you want to run a store procedures without a parameter, no if you need to add a parameter.  
0
 

Author Comment

by:g_temp
ID: 6289251
Hi,
I try with the answer but the system complains with the following message. Why ?


Error 7399: OLE DB provider 'msolap' reported an error. The provider did not give any information about the error.
0
Get MySQL database support online, now!

At Percona’s web store you can order your MySQL database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card.

 
LVL 1

Expert Comment

by:SYASSIN
ID: 6289629
Check your username and password as well as your library name.  Remember the library name is  not the cube name, its the catalog name.

Also, you may want to try adding the olap server as a linked server.  From the query analyzer type the following:

EXEC sp_addlinkedserver
@server='olap_server',
@srvproduct='',
@provider='msolap',
@datasrc='servername',
@catalog='catalogname (eg Foodmart)'

Once you have added the linked server, you can simplify the above stored procedure to the following:

CREATE PROCEDURE procedurename
as
select * from
openrowset(olap_server, 'PLACE MDX Statement here')

hope that helps.
0
 

Author Comment

by:g_temp
ID: 6291983
Hi,
I encounter error putting the following statement
but the system complian error about the openrowset,
this statement work perfectly on VC using ADO.
Why ?

select [Measures].members on columns, non empty [CardID].members on rows from Card where [ProdID].[0162930169]
0
 
LVL 1

Expert Comment

by:SYASSIN
ID: 6292026
try the following:

select {[Measures].members} on columns, non empty {[CardID].members} on rows from Card where ([ProdID].[0162930169])

or

select {[Measures].members} on columns, {non empty [CardID].members} on rows from Card where ([ProdID].[0162930169])
0
 
LVL 1

Accepted Solution

by:
SYASSIN earned 600 total points
ID: 6294256
try the following:

select {[Measures].members} on columns, non empty {[CardID].members} on rows from Card where ([ProdID].[0162930169])

or

select {[Measures].members} on columns, {non empty [CardID].members} on rows from Card where ([ProdID].[0162930169])
0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question