dbTalk Databases Forums  

Variating number of columns

microsoft.public.sqlserver.olap microsoft.public.sqlserver.olap


Discuss Variating number of columns in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Koen
 
Posts: n/a

Default Variating number of columns - 02-20-2006 , 02:48 AM






Hi,

I use this mdx to show how much each Advertiser earns on a monthly base, and
this for 5 years:

select
{[Broadcast Date].[Year].[2001],[2002],[2003],[2004],[2005]} ON COLUMNS,
Non Empty CrossJoin({[Advertiser Responsible].[All Advertiser
Responsible].[AnAdvertiser]},[Month].[All Month].CHILDREN) ON 1


I use this MDX in combination with openquery. The idea is to put the result
in a temp table, perform some actions on the data and then use it in a Stored
Procedure.

When the MDX has results, I can create a table that looks like this:

Advertiser | Month | 2001 | 2002 | 2003 | 2004 | 2005

But when the query has no results, it "drops" the first two columns.
Therefore, i can never use a self-created temp table.

Does anyone has any idea to make sure that the output result always has the
same number of columns ?

Thanks!
from [My Cube]

Reply With Quote
  #2  
Old   
Koen
 
Posts: n/a

Default RE: Variating number of columns - 02-22-2006 , 02:10 AM






Hi all, i've solved it by useing exec and the query in varchar. That way, the
parser skips it because it sees it as text.

Regards,

"Koen" wrote:

Quote:
Hi,

I use this mdx to show how much each Advertiser earns on a monthly base, and
this for 5 years:

select
{[Broadcast Date].[Year].[2001],[2002],[2003],[2004],[2005]} ON COLUMNS,
Non Empty CrossJoin({[Advertiser Responsible].[All Advertiser
Responsible].[AnAdvertiser]},[Month].[All Month].CHILDREN) ON 1


I use this MDX in combination with openquery. The idea is to put the result
in a temp table, perform some actions on the data and then use it in a Stored
Procedure.

When the MDX has results, I can create a table that looks like this:

Advertiser | Month | 2001 | 2002 | 2003 | 2004 | 2005

But when the query has no results, it "drops" the first two columns.
Therefore, i can never use a self-created temp table.

Does anyone has any idea to make sure that the output result always has the
same number of columns ?

Thanks!
from [My Cube]

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.