clsCubeLevel

ms133281.note(zh-cn,SQL.90).gif注意:
  下一版本的 Microsoft SQL Server 将删除该功能。请不要在新的开发工作中使用该功能,并尽快修改当前还在使用该功能的应用程序。

An object of ClassType clsCubeLevel provides a specific implementation of the Decision Support Objects (DSO) Level interface. This object provides collections and properties through the Level interface. There are no methods associated with an object of ClassType clsCubeLevel.

备注

When a dimension within a database is assigned to a cube, the cube inherits all levels of the dimension. An object of ClassType clsCubeLevel allows access to these levels. Because not all database dimensions necessarily apply to a given cube, one advantage to accessing the levels of a cube directly is that you avoid traversing the dimensions and levels of the entire database to determine which levels are used in a cube.

示例

Use the following code to create a dimension and levels for a database and apply them to a cube:

'Assume an object (dsoDB) of ClassType clsDatabase exists
'with an existing data source
Dim dsoDim As DSO.Dimension
Dim dsoLevel As DSO.Level
Dim dsoDS As DSO.Datasource

'Add a dimension and levels to the database
Set dsoDS = dsoDB.Datasources(1)
Set dsoDim = dsoDB.Dimensions.AddNew("Products")
Set dsoDim.DataSource = dsoDS   'Dimension DataSource
dsoDim.FromClause = "product"   'Source Table

'Add a Product Brand Name level
Set dsoLev = dsoDim.Levels.AddNew("Brand Name")
dsoLev.MemberKeyColumn = """product"".""brand_name"""
dsoLev.ColumnSize = 255
dsoLev.ColumnType = adWChar
dsoLev.EstimatedSize = 100

'Add a Product Name level
Set dsoLev = dsoDim.Levels.AddNew("Product Name")
dsoLev.MemberKeyColumn = """product"".""product_name"""
dsoLev.ColumnSize = 255
dsoLev.ColumnType = adWChar
dsoLev.EstimatedSize = 1560
dsoDim.Update
'Add additional dimensions and levels as required
...
'Add cube to database
Dim dsoCube As MDStore
Set dsoCube = dsoDB.MDStores.AddNew(strCubeName)

'Create and configure a DataSource object for the cube
Set dsoDS = dsoDB.DataSources(1)
dsoCube.DataSources.AddNew (dsoDS.Name)

'Set source fact table and estimated rows in fact table
dsoCube.SourceTable = """sales_fact_1998"""
dsoCube.EstimatedRows = 1000
            
'Add shared database dimensions
'Cube inherits dimension levels
dsoCube.Dimensions.AddNew ("Products")
'Add other shared or private dimensions
 

请参阅

参考

Collections, clsCubeLevel
IsDisabled (Level Interface)
Level Interface
Properties, clsCubeLevel

帮助和信息

获取 SQL Server 2005 帮助