|
I have a MDX Query that when I run it in Management Studio or BIS (Reporting Services) I Get one set of results. If however I run it via OPENROWSET I get diffrent results. The major diffrence is that via the OPENROWSET I get the hierrachy and not the members as with the MDX query. The field That I query is a Hierarchy diemension. How can I get the same reults from OPENROWSET as from Management Studio. MDX Query: MDX (Against Adventure Works) SQL With Openrowset against the same cube. Results Results:
(comments are locked)
|
|
Hi, this happens as you are getting members of a multi-level hierchy In case of MDX query a tuples are retrieved and particular tuple uniquely identifies the node (there are retrieved also additional properties etc) so you see only the names listed, but by double click on the cell you can see other properties like hierarchy level etc. In case of OPENROWSET, the hierarchy is flattened and each level of hierarchy is represented by separate column. In this way you see the whole path to the leaf node in the flattened element. If you want to see only the names of leaf nodes, you can collapse the result into single column using SQL It will give you results like below:
(comments are locked)
|


Oh....@dfswart Please trim your results. I hope there is no real data you have posted. If there is some, then replace it with some test data OR by replacing the real data with XYZ OR ABC etc.
I guess a better way could have been by adding an image.
The results from the OPENROWSET is as follow: [Employee].[Employees].[Employee Level 02].[MEMBER_CAPTION] [Employee].[Employees].[Employee Level 03].[MEMBER_CAPTION] [Employee].[Employees].[Employee Level 04].[MEMBER_CAPTION] [Employee].[Employees].[Employee Level 05].[MEMBER_CAPTION] [Employee].[Employees].[Employee Level 06].[MEMBER_CAPTION] [Measures].[UniqueName] NULL NULL NULL NULL NULL [Employee].[Employees].[All Employees] Ken J. Sánchez NULL NULL NULL NULL [Employee].[Employees].&[112] Ken J. Sánchez Brian S. Welcker NULL NULL NULL [Employee].[Employees].&[277] Ken J. Sánchez Brian S. Welcker Amy E. Alberts NULL NULL [Employee].[Employees].&[290] Ken J. Sánchez Brian S. Welcker Amy E. Alberts Jae B. Pak NULL [Employee].[Employees].&[291]
From the Management studio Query:
Employee Name UniqueName All Employees [Employee].[Employees].[All Employees] Ken J. Sánchez [Employee].[Employees].&[112] Brian S. Welcker [Employee].[Employees].&[277] Amy E. Alberts [Employee].[Employees].&[290] Jae B. Pak [Employee].[Employees].&[291] Rachel B. Valdez [Employee].[Employees].&[295] Ranjit R. Varkey Chudukatil [Employee].[Employees].&[292] Stephen Y. Jiang [Employee].[Employees].&[272]
The data is from Adventure Works.
I will replace the results in your question with this one. I hope there is no problem with that.
Moreover, can you please pinpoint the major difference?