Solved

Mdx Queries on Stored Procedure

Posted on 2001-07-10
7
1,828 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
  • 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
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 
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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
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.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

829 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