views:

14

answers:

1

Using either a view and/or stored procedure, I can return the results of executing an MDX query against SQL Analysis Services (using OPENROWSET against a linked SSAS Server into SQL).

Unfortunately, the resultset doesn't include a PK field...or for that matter, even a column which COULD act as a PK if I were to hack the model.

Can anyone think of a hacktacular trick I can use to:

  1. Add a field to my result which inserts some auto-incrementing value (to act as a PK candidate)
  2. Somehow set this field to be the PK so that I can easily build an entity off of it?

I'm 99% sure the answer is "no". At this point I can already get data back from SSAS by using an SSRS report with OData rendering...but I have to create my types manually when I use play w/ LINQ.

If someone can nail #1 & #2 for me, this may be a potentially better way to access the data since the Modeler would create my types (entities) for me.

Thanks!

A: 

I'm not sure I understand why you can't have a column that could act as a primary key. I just ran a similar query against one of my cubes filtered to a list of members and each column name contained the member name. Here is an example:

Submission:

 SELECT Measures.members ON ROWS,
 Customer.[CustomerIdKeyField].[UniqueCustomerId] ON COLUMNS
 FROM [Postage Prints]

Returned:

(colum header)  [Measures].[MeasuresLevel].[MEMBER_CAPTION] [Customer].[CustomerIdKeyField].&[UniqueCustomerId]

(row) Measure1  9.6800000000000015

(row) Measure2  22

(row) Measure3  1
Registered User