Solved

Mdx Queries on Stored Procedure

Posted on 2001-07-10
7
1,831 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift 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 200 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 Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

732 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