MDAC 2.5 SDK - OLE DB Programmer's Reference
Chapter 24: Multidimensional Expressions


 

The MDX Statement

The complete construct of the MDX statement follows:

<MDX_statement> ::= <select_statement>
                  | <create_formula_statement>
                  | <drop_formula_statement>

<select_statement> ::= [WITH <formula_specification>]
                        SELECT [<axis_specification> 
                               [, <axis_specification>...]]
                        FROM [<cube_specification>]
                        [WHERE [<slicer_specification>]]
                        [<cell_props>]

<formula_specification> ::= <single_formula_specification>
                           [<single_formula_specification>...]

<single_formula_specification> ::= <member_specification>
                                 | <set_specification>

<member_specification> ::= MEMBER <member_name> AS <value_expression>
                           [, <solve_order_specification>]
                           [, <member_property_definition>...]

<member_name> ::= <member>.<identifier> 
                | <cube_name>.<member>.<identifier>

Note

  1. The identifier defines a new member. The qualification member has enough information to specify the dimension and the level in the dimension that this new member should be on.

  2. If <member_name> is part of a member specification that appears in a <create_formula_statement> or is part of a <drop_formula_statement>, it must be qualified by a cube name, as in the second production above.
<solve_order_specification> ::= SOLVE_ORDER = <unsigned_integer>

<member_property_definition> ::= <identifier> = <value_expression>

Note   Because the property definition appears in the context of a member definition, there is enough information to associate the identifier (which is the property name) in the above production with a member.

<set_specification> ::= SET <set_name> AS <set>

<set_name> ::= <identifier> | <cube_name>.<identifier>

Note   If <set_name> is part of a set specification that appears in a <create_formula_statement> or is part of a <drop_formula_statement>, it must be qualified by a cube name, as in the second production above.

<axis_specification> ::= [NON EMPTY] <set> [<dim_props>] ON <axis_name>

<axis_name> ::= COLUMNS
              | ROWS
              | PAGES
              | CHAPTERS
              | SECTIONS
              | AXIS(<index>)

<dim_props> ::= [DIMENSION] PROPERTIES <property> [, <property>...]

<cube_specification> ::= [<cube_name> [,<cube_name>…]]

<slicer_specification> ::= {<set> | <tuple>}

<cell_props> ::= [CELL] PROPERTIES <cell_property> [, <cell_property>...]

<cell_property> ::= <mandatory_cell_property>
                  | <optional_cell_property>
                  | <provider_specific_cell_property>

<mandatory_cell_property> ::= CELL_ORDINAL | VALUE | FORMATTED_VALUE

<optional_cell_property> ::= FORMAT_STRING
                           | FORE_COLOR
                           | BACK_COLOR
                           | FONT_NAME
                           | FONT_SIZE
                           | FONT_FLAGS

<provider_specific_cell_property> ::= <identifier>

<create_formula_statement> ::= CREATE [<scope>]<formula_specification>

<drop_formula_statement> ::= <drop_member_statement> 
                           | <drop_set_statement>

<drop_member_statement> ::= DROP MEMBER <member_name> 
                                     [, <member_name>...]

<drop_set_statement> ::= DROP SET <set_name> [, <set_name>...]

<scope> := GLOBAL | SESSION