OrdinalPosition (Command Interface)

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

The OrdinalPosition property of the Command interface contains the ordinal position of a command in the Commands collection in the parent MDStore object.

Applies To:clsCubeCommand, clsDatabaseCommand, clsRoleCommand

Data Type

Integer

Access

Read-only

备注

Ordinal position determines the order in which commands are executed. This order is important when one command depends on another command (for example, a CREATE SET command that uses a member defined in a CREATE MEMBER command). In this case, the CREATE MEMBER command should have a lower OrdinalPosition property value than the CREATE SET command. However, the ordinal position of the command does not affect the solve order of the calculated member or calculated cells definition the command may create. For more information on how solve order affects calculated cells and calculated members, see Understanding Pass Order and Solve Order.

示例

The following code creates three new commands in the Commands collection of the FoodMart 2000 database. It then enumerates the collection, printing the OrdinalPosition and Name properties to the Debug window. Then, the code example deletes and re-creates the first command, and again enumerates the collection to demonstrate the change in ordinal position on the other commands.

    Dim dsoServer As New DSO.Server
    Dim dsoDB As DSO.MDStore
    Dim dsoCmd As DSO.Command
    
    ' Connect to the local Analysis server.
    dsoServer.Connect "LocalHost"
    
    ' Open the FoodMart 2000 database.
    Set dsoDB = dsoServer.MDStores("FoodMart 2000")
    
    ' Add three sample commands.
    Set dsoCmd = dsoDB.Commands.AddNew("Command3")
    Set dsoCmd = dsoDB.Commands.AddNew("Command1")
    Set dsoCmd = dsoDB.Commands.AddNew("Command2")
    
    ' Iterate through the commands for the database.
    For Each dsoCmd In dsoDB.Commands
        ' Print its name and ordinal position
        Debug.Print dsoCmd.OrdinalPosition & " = " & dsoCmd.Name
    Next

    ' Now, delete the Command3 command and add it again.
    dsoDB.Commands.Remove "Command3"
    Set dsoCmd = dsoDB.Commands.AddNew("Command3")
    
    ' Iterate again through the commands for the database.
    Debug.Print "-----"
    For Each dsoCmd In dsoDB.Commands
        ' Print its name and ordinal position
        Debug.Print dsoCmd.OrdinalPosition & " = " & dsoCmd.Name
    Next

请参阅

参考

Command Interface

其他资源

CREATE SET 语句 (MDX)
CREATE MEMBER 语句 (MDX)

帮助和信息

获取 SQL Server 2005 帮助