次の方法で共有


Merge (MDStore Interface)

ms135491.note(ja-jp,SQL.90).gifメモ :
  この機能は、Microsoft SQL Server の次のバージョンで削除されます。新規の開発作業ではこの機能を使用しないようにし、現在この機能を使用しているアプリケーションはできるだけ早く修正してください。

The Merge method of the MDStore interface merges two partitions into a single partition. The partitions must have the same aggregations and storage modes.

Applies To:clsPartition

構文

object.Merge(ByVal SourceName As String)

パラメータ

  • object
    The partition object into which to merge the source partition object.
  • SourceName
    A string that contains the name of the source partition object.

解説

Before merging two partitions that specify data slices, you must first set the slice of the receiving partition to the slice that will apply after the merge has been completed. Otherwise, the partitions will not be successfully merged. The slice for the receiving partition must be the parent of the first level, where the slice values for the two partitions differ.

For example, if you are merging a partition that contains data based on the slice [AllTime].[1998].[Quarter2] into a partition that contains [AllTime].[1998].[Quarter1], the target partition's slice must be set to the parent of the two slices that differ, in this case [AllTime].[1998]. The target partition's slice must be set to this value before merging the partitions. For more information, see Managing Partitions and Merging Partitions.

ms135491.note(ja-jp,SQL.90).gifメモ :
  This adjustment is done automatically when you merge partitions using the Analysis Manager user interface.

Examples

The following code prepares two partitions for a merge by merging the data slice values so they are equal:

Sub MergeDataSlices(SourcePart As DSO.MDStore, _
    TargetPart As DSO.MDStore)
    ' This example code merges the data slices of two partitions.
    ' This subroutine does not merge the partitions; instead,
    ' it compares the source and target partitions, changing
    ' the target partition to match the source partition to
    ' prepare it for merging.
    
    Dim dsoDimSource As DSO.Dimension
    Dim dsoLevelSource As DSO.Level
    Dim dsoDimTarget As DSO.Dimension
    Dim dsoLevelTarget As DSO.Level
    
    Dim nDim As Integer, nLev As Integer, nLev2 As Integer
    
    ' Search for the first level where the slice differs.
    ' Then use the parent level just above it.
    ' Loop through each dimension in the source partition.
    For nDim = 1 To SourcePart.Dimensions.Count
        Set dsoDimSource = SourcePart.Dimensions(nDim)
        Set dsoDimTarget = TargetPart.Dimensions(nDim)
        
        ' For each source and target dimension, compare the two
        ' and find the first level where the data slice differs.
        For nLev = 1 To dsoDimSource.Levels.Count
            Set dsoLevelSource = dsoDimSource.Levels(nLev)
            Set dsoLevelTarget = dsoDimTarget.Levels(nLev)
            
            If dsoLevelSource.SliceValue <> dsoLevelTarget.SliceValue Then
            
                ' Clear the slice values for all of the levels below
                ' in the target partition.
                For nLev2 = nLev To dsoDimSource.Levels.Count
                    Set dsoLevelTarget = dsoDimTarget.Levels(nLev2)
                    dsoLevelTarget.SliceValue = ""
                Next
            
                ' Stop looping through levels.
                Exit For
            
            End If
        Next
    Next
    
    ' Now that the target partition is ready for merge,
    ' update it.
    TargetPart.Update
End Sub

参照

関連項目

MDStore Interface
UnlockObject (MDStore Interface)

ヘルプおよび情報

SQL Server 2005 の参考資料の入手