JavaScript Editor Ajax toolkit     Ajax tutorials 

Main Page

Previous Page
Next Page

20.7. Administering SSAS Objects

SSAS supports administration APIs that you can use to create or modify SSAS objects, process SSAS objects, and manage SSAS instances. This section describes Analysis Management Objects (AMO ) and Decision Support Objects (DSO ) .

20.7.1. Analysis Management Objects (AMO)

AMO is a .NET Framework assembly containing a hierarchy of classes that lets you programmatically create, modify, and process SSAS objects and manage SSAS instances. The AMO namespace is Microsoft.AnalysisServices, implemented in the Microsoft.AnalysisServices.dll assembly, which is located by default in the C:\Program Files\Microsoft SQL Server\90\SDK\Assemblies directory.

This example shows how to use AMO objects to retrieve information about key collections in an SSAS databasein this case, the Adventure Works DW database. You need a reference to the Microsoft.AnalysisServices assembly to compile and run the example.

    using System;
    using System.Data;

    using Microsoft.AnalysisServices;

    class Program
        static void Main(string[] args)
            Server server = new Server(  );
              "Data Source=localhost;Catalog=Adventure Works DW Standard Edition");
            Database db = server.Databases["Adventure Works DW Standard Edition"];

            Console.WriteLine("DATA SOURCES:");
            foreach (DataSource ds in db.DataSources)

            Console.WriteLine(Environment.NewLine + "DATA SOURCE VIEWS:");
            foreach (DataSourceView dsv in db.DataSourceViews)

            Console.WriteLine(Environment.NewLine + "CUBES:");
            foreach (Cube c in db.Cubes)

            Console.WriteLine(Environment.NewLine + "DIMENSIONS:");
            foreach (Dimension d in db.Dimensions)

            Console.WriteLine(Environment.NewLine + "MINING STRUCTURES:");
            foreach (MiningStructure ms in db.MiningStructures)

            Console.WriteLine(Environment.NewLine + "ROLES:");
            foreach (Role r in db.Roles)

            Console.WriteLine(Environment.NewLine + "ASSEMBLIES:");
            foreach (Assembly a in db.Assemblies)

            Console.WriteLine(Environment.NewLine + "Press any key to continue.");
            Console.ReadKey(  );

Results are shown in Figure 20-12.

Figure 20-12. Results for AMO example

The Server class is the top-level class in the AMO class hierarchy and represents the implementation of SSAS. Call the Connect( ) method of the Server class to connect to an SSAS instance. The Databases property of the Server class contains a collection of databases in the SSAS instance as Database objects. The Database class exposes a collection of properties that provides access to collections of objects in the database, including data sources, data-source views, cubes, dimensions, mining structures, roles, and assemblies. These collections and their objects have methods and properties used to query and manipulate the database objects.

20.7.2. Decision Support Objects (DSO)

DSO is a COM library that you can use to create applications that programmatically administer SSAS objects. You should use AMO instead of DSO in new applications and migrate existing applications to AMO, because DSO will be removed in the next version of SQL Server. For more information about DSO, see Microsoft SQL Server 2005 Books Online.

Previous Page
Next Page

JavaScript Editor Ajax toolkit     Ajax tutorials