Page 1 of 1

Dimensions presented as Cubes

PostPosted: Sun Nov 09, 2008 8:50 am
by stephen
When I query the number of cubes in the Analysis Services Tutorial database with a AdomdConnections.Cubes.Count I retrieved a count of 9 but the database had just one cube and 8 Dimensions
It seems that the dimensions are counted as cubes, when you are connected as an administrator.

Quote from book Page 448, MDX Solutions (Second Edition, Wiley)
In Microsoft Analysis Services 2005, each dimension is also presented as a Cube. These Cubes are named by prefixing a $ to the dimension name. These special cubes are restricted to users with database administrator rights.]

Example Code from MSDN
http://msdn.microsoft.com/en-us/library/ms123461(SQL.90).aspx

Code: Select all
private string RetrieveCubesAndDimensions()
{
    System.Text.StringBuilder result = new System.Text.StringBuilder();

    //Connect to the local server
    using (AdomdConnection conn = new AdomdConnection("Data Source=localhost;"))
    {
        conn.Open();

        //Loop through every cube
        foreach (CubeDef cube in conn.Cubes)
        {
            //Skip hidden cubes.
            if (cube.Name.StartsWith("$"))
                continue;

            //Write the cube name
            result.AppendLine(cube.Name);

            //Write out all dimensions, indented by a tab.
            foreach (Dimension dim in cube.Dimensions)
            {
                result.Append("\t");
                result.AppendLine(dim.Name);
            }
        }

        //Close the connection
        conn.Close();
    }

    //Return the results
    return result.ToString();
}