Condividi tramite


IIndexDefinition::DropIndex

Drops an index from the base table.

Syntax

HRESULT DropIndex(
   DBID   *pTableID,
   DBID   *pIndexID);

Parameters

  • pTableID
    [in] A pointer to the DBID of the base table.

  • pIndexID
    [in] A pointer to the DBID of the index to drop. This must be an index on the table specified with pTableID. If pIndexId is a null pointer, all indexes for the table specified with pTableID are dropped.

Return Code

  • S_OK
    The method succeeded, and the index has been dropped from the base table.

  • DB_S_ERRORSOCCURRED
    pIndexID was a null pointer, at least one index was successfully dropped, but one or more indexes for the specified table could not be dropped. The consumer can determine the set of indexes not dropped through the INDEXES schema rowset.

  • E_FAIL
    A provider-specific error occurred.

  • E_INVALIDARG
    pTableID was a null pointer.

  • DB_E_ERRORSOCCURRED
    pIndexID was a null pointer, but none of the indexes for the specified table could be dropped.

  • DB_E_INDEXINUSE
    The specified index was in use.

  • DB_E_NOINDEX
    The specified index does not exist in the current data store or did not apply to the specified table.

  • DB_E_NOTABLE
    The specified table does not exist in the current data store.

  • DB_E_TABLEINUSE
    The specified table was in use, and the provider could not drop the index with the table open.

  • DB_SEC_E_PERMISSIONDENIED
    The consumer did not have sufficient permission to drop the index.

Comments

For partitioned indexes, a call to this method drops all partitions.

If IIndexDefinition::DropIndex returns any errors, the index is not dropped.

If pIndexID is a null pointer and one or more indexes for that table cannot be dropped, the processing continues to attempt to drop the remaining indexes for that table.

See Also

Reference

IIndexDefinition::CreateIndex