1

I am trying to fill MDX query result to a datatable. Query is generating dynamically. When i fill datatable column header like [Dim Date].[Day].[Day]. I need it Log Date.

Is there any way to change column header ? I mean, in TSQL we using

select firstName [User] from users

Is there any way to achieve this ?

Thanks in advance

Arun Raj
  • 969
  • 8
  • 19

1 Answers1

0

You can do this on the SQL side like this:

WITH mdx as (
    <your MDX query>
    )
SELECT [[Dim Date]].[Day]].[Day]]] as [Log Date]
       ...
  FROM mdx

The escaping rules of square brackets make this a bit strange: You have to double all closing square brackets.

You can get this slightly more easy, avoiding the square bracket quoting in the rename action by using

WITH mdx([Log Date], ...) as (
    <your MDX query>
    )
SELECT [Log Date], ...
  FROM mdx

enumerating the desired column names after the CTE name "mdx".

FrankPl
  • 13,205
  • 2
  • 14
  • 40