Condividi tramite


OrdinalPosition (Command Interface)

[!NOTA]   Questa funzionalità verrà rimossa a partire dalla prossima versione di Microsoft SQL Server. Non utilizzare questa funzionalità in un nuovo progetto di sviluppo e modificare appena possibile le applicazioni in cui questa funzionalità viene utilizzata.

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

Osservazioni

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.

Esempio

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

Vedere anche

Riferimento

Command Interface

Altre risorse

Istruzione CREATE SET (MDX)
Istruzione CREATE MEMBER (MDX)

Guida in linea e informazioni

Assistenza su SQL Server 2005