SQL SERVER联机帮助上有说明:Working with Servers:
Describes how to connect to an Analysis server
Working with Databases Explains how to list, add, and delete databases for an Analysis server Working with Data Sources:
Shows how to list data sources on, add new data sources to, or delete existing data sources for a database Working with Dimensions and Levels:
Demonstrates how to list, add, and delete shared dimensions for a database
Working with Cubes and Measures Describes how to list, add, delete, and process cubes for a database, including examples on how to list and add measures to a cube
Describes how to connect to an Analysis server
Working with Databases Explains how to list, add, and delete databases for an Analysis server Working with Data Sources:
Shows how to list data sources on, add new data sources to, or delete existing data sources for a database Working with Dimensions and Levels:
Demonstrates how to list, add, and delete shared dimensions for a database
Working with Cubes and Measures Describes how to list, add, delete, and process cubes for a database, including examples on how to list and add measures to a cube
examples in DSO
Dim dsoServer As New DSO.Server
Dim dsoDB As DSO.MDStore
Dim dsoDS As DSO.DataSource
Dim dsoDim As DSO.Dimension
Dim dsoLev As DSO.Level
Dim dsoMember As DSO.MemberProperty Dim strDBName As String ' Constants used for ColumnType property
' of the DSO.Level object.
' Note that these constants are identical to
' those used in ADO in the DataTypeEnum enumeration.
Const adWChar = 130
Const adInteger = 3
Const adDouble = 5 ' Initialize variables for the database name.
strDBName = "TestDB" ' Create a connection to the Analysis server.
dsoServer.Connect "LocalHost" ' Set the database object.
Set dsoDB = dsoServer.MDStores(strDBName) ' Set the data source for the database object.
' A data source is required to run this example.
If dsoDB.DataSources.Count = 0 Then
MsgBox "Database " & dsoDB.Name & _
" has no data sources."
Else
Set dsoDS = dsoDB.DataSources(1)
End If ' Create Products dimension and levels.
Set dsoDim = dsoDB.Dimensions.AddNew("Products")
Set dsoDim.DataSource = dsoDS ' Dimension data source
dsoDim.FromClause = "product" ' Related table
dsoDim.JoinClause = "" ' Used in snowflake schema ' Add Brand Name level.
Set dsoLev = dsoDim.Levels.AddNew("Brand Name")
dsoLev.MemberKeyColumn = """product"".""brand_name"""
dsoLev.ColumnSize = 255 ' Column data size in bytes
dsoLev.ColumnType = adWChar ' Column data type
dsoLev.EstimatedSize = 1 ' Distinct members in column ' Add Product Name level.
Set dsoLev = dsoDim.Levels.AddNew("Product Name")
dsoLev.MemberKeyColumn = """product"".""product_name"""
dsoLev.ColumnSize = 255
dsoLev.ColumnType = adWChar
dsoLev.EstimatedSize = 1 ' Update the Products dimension.
dsoDim.Update ' Inform the user.
MsgBox "Dimension " & dsoDim.Name & " added to " & _
dsoDim.DataSource.Name & " data source." ' Create Stores dimension and levels.
Set dsoDim = dsoDB.Dimensions.AddNew("Stores")
Set dsoDim.DataSource = dsoDS ' Dimension data source
dsoDim.FromClause = "store" ' Related table
dsoDim.JoinClause = "" ' Used in snowflake schema ' Add Store Country level.
Set dsoLev = dsoDim.Levels.AddNew("Store Country")
dsoLev.MemberKeyColumn = """store"".""store_country"""
dsoLev.ColumnSize = 50 ' Column data size in bytes
dsoLev.ColumnType = adWChar ' Column data type
dsoLev.EstimatedSize = 1 ' Distinct members in column ' Add Store State level.
Set dsoLev = dsoDim.Levels.AddNew("Store State")
dsoLev.MemberKeyColumn = """store"".""store_state"""
dsoLev.ColumnSize = 50
dsoLev.ColumnType = adWChar
dsoLev.EstimatedSize = 1 ' Add Store City level.
Set dsoLev = dsoDim.Levels.AddNew("Store City")
dsoLev.MemberKeyColumn = """store"".""store_city"""
dsoLev.ColumnSize = 50
dsoLev.ColumnType = adWChar
dsoLev.EstimatedSize = 1 ' Add Store ID level.
Set dsoLev = dsoDim.Levels.AddNew("Store ID")
dsoLev.MemberKeyColumn = """store"".""store_ID"""
dsoLev.ColumnSize = 4
dsoLev.ColumnType = adInteger
dsoLev.EstimatedSize = 1 ' Add a member property to the Store ID level.
Set dsoMember = dsoLev.MemberProperties.AddNew("Store SQFT", _
sbclsRegular)
dsoMember.Description = "Store size in square feet"
dsoMember.SourceColumn = """store"".""store_sqft"""
dsoMember.ColumnSize = 4
dsoMember.ColumnType = adDouble ' Update the Stores dimension.
dsoDim.Update ' Inform the user.
MsgBox "Dimension " & dsoDim.Name & " added to " & _
dsoDim.DataSource.Name & " data source."End Sub
我知道建立rolap模型的方法,也用了ms analyse service的foodmart例子access数据库,但是是英文的,对于产品演示来说不太好。
所以我找找一个中文的例子数据库。