Solved

Mdx Queries on Stored Procedure

Posted on 2001-07-10
7
1,834 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
Industry Leaders: 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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
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.

691 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