开发者

Convert MDX query result into relational format

开发者 https://www.devze.com 2023-03-21 02:15 出处:网络
I have a SQL stored proc that uses a linked server and Openquery to execute a MDX query.The result returned from the MDX query is in the format of:

I have a SQL stored proc that uses a linked server and Openquery to execute a MDX query. The result returned from the MDX query is in the format of:

Month 1 | Month 2 | Month 3 | Month 4

12        5         4         7

where the columns 开发者_Python百科are dynamic i.e. I never know how many months will be in the output.

How can I transpose the output into a relational format e.g.

Two columns.

Col 1 | Col 2
-----   -----
Month1  12
Month2  5
Month3  4

etc etc


You'll need to change your original MDX query from something like :

Select
 [Months].members on 0
from [MyCube]

to something like this one :

Select
 [Measures].defaultmember on 0,
 [Months].members on 1
from [MyCube]
0

精彩评论

暂无评论...
验证码 换一张
取 消