Free Newsletters:
DatabaseDaily  
Database Journal
Search Database Journal:
 
MS SQL Oracle DB2 Access MySQL PostgreSQL Sybase PHP SQL Etc SQL Scripts & Samples Links Database Forum DBA Videos
internet.com

» Database Journal Home
» DBA Videos
» Database Articles
» Database Tutorials
MS SQL
Oracle
MS Access
MySQL
DB2
» RESOURCES
Database Tools
SQL Scripts & Samples
Links
» Database Forum
» DBA Jobs
» Sitemap

News Via RSS Feed



follow us on Twitter

Marketplace Partners
Be a Marketplace Partner

internet.commerce
Be a Commerce Partner


















Mariposa Bot Shipped With Vodafone Smartphone

IT Job Market Heating Up: Report

Bing Makes Strides But Momentum Stalls

internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


Database Journal | DBA Support | SQLCourse | SQLCourse2







Java Developer (IL)
Next Step Systems
US-IL-Chicago

Justtechjobs.com Post A Job | Post A Resume

Featured Database Articles

MS SQL

December 16, 2002

MDX Essentials: Structure of the MDX Data Model

By William Pearson


Practical Examples

Because we have covered enough of the basics to begin practicing some of the concepts, let's build a simple query and reinforce our understanding. We will return to the MDX Sample Application (installed with Analysis Services, and discussed further in Article One, MDX at First Glance: Introduction to MDX Essentials), and take the following steps, to practice interacting with Analysis Services in a hands-on manner.

  1. Go to the Start button on the PC, and then navigate to Microsoft SQL Server -> Analysis Services.
  2. Click MDX Sample Application.

We are initially greeted by the Connect dialog, shown in Illustration 1 below.



Illustration 1: The Connect Dialog for the MDX Sample Application


The illustration above depicts the name of one of my servers, RAPHAEL, and properly indicates that we will be connecting via the MSOLAP provider (the default).

  1. Click OK.

The MDX Sample Application window appears.

  1. Clear the top area (the Query pane) of any queries or remnants that might appear.
  2. Ensure that FoodMart 2000 is selected as the database name in the DB box of the toolbar.
  3. Select the HR cube in the Cube drop-down list box.

The MDX Sample Application window should resemble that shown below, complete with the information from the HR cube displaying in the Metadata tree (in the left section of the Metadata pane, between the Query pane at the top of the application window and the Results pane, at the bottom.).



Illustration 2: The MDX Sample Application Window (Compressed)


We will begin with an illustration: We are asked by an information consumer in Human Relations to provide the total headcount for the years 1997 and 1998 individually for the entire organization.

  1. Type the following query into the Query pane:
-- MDX02-1: Tutorial Query No. 1 SELECT {([Time].[1997]), ([Time].[1998])}ON COLUMNS FROM HR WHERE ([Measures].[Count])

The diagram below labels the various parts of the query:



Illustration 3: Labeled Parts of a Basic MDX Query


  1. Click Query on the top menu, and then select Run.

We see the results below, which appear in the Query pane as soon as Analysis Services fills the cells that it determines to be specified by the query.



Illustration 4: The Initial Query Results


Note: For an explanation of the comment line, together with other general discussion regarding attributes of the basic MDX query structure, see the first article of the series.

The query delivers the results that were requested by the information consumer. The results display columns, but no rows, because we specified only one axis. We will add specification of the Row axis in the next example.

Anytime we use single tuples, such as we do in specifying the "x" axis above (our only axis), we enclose the tuples in curled braces to signify that they are tuples contained within a set, as shown.

  1. Save the query by selecting File -> Save As, and call the file MDX02-1.


Page 5: Practical Example (Continued)




Go to page: Prev  1  2  3  4  5  6  Next  

Tools:
Add databasejournal.com to your favorites
Add databasejournal.com to your browser search box
IE 7 | Firefox 2.0 | Firefox 1.5.x
Receive news via our XML/RSS feed

MS SQL Archives








Latest Forum Threads
MS SQL Forum
Topic By Replies Updated
sql maintenance plan fails database missing tbrownch 5 March 12th, 08:48 AM
Inner and outer select mussab 2 March 10th, 04:16 AM
SQL server 2008 in windows 7 pro problem theresatan 2 March 6th, 08:35 PM
code for re-build index and shrink db or file? mib 7 March 5th, 08:50 AM









The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers