Skip to content

Delete_Index

See Also: Create_Index, Structure_Start

Purpose

To delete an index from the structure of a database table.

Syntax

Delete_Index {table-handle} {index-num}

Where {table-handle} is a handle to the database table, and {index-num} is the number of the index to delete.

What It Does

This command will delete the index {index-num} from the database table {table-handle}. The {table-handle} must be for a table that has had a Structure_Start done on it for a permanent index. The index table (rootname.K##) is also deleted.

A temporary index can be deleted outside a Structure_Start ... Structure_End block with Delete_Index. Read more about temporary indexes in Create_Index.

Example

Procedure DeleteIndex String sTableName Integer iIndexNo
    handle hTable
    // Open database table
    Open sTableName as hTable
    // Start of the structure operation.
    // The embedded database driver name is "DATAFLEX".
    Structure_Start hTable "DATAFLEX"
    // Specify the index to delete
    Delete_Index hTable iIndexNo
    Structure_End hTable DF_STRUCTEND_OPT_NONE
End_Procedure

Notes

  • If you delete the main index of a column and then attempt to execute a Find command by this column, you will get an error "Field not Indexed". For example, assume index #2 is the main index for column Employee.Salary. If you delete index #2, the following find command would return an error:

    Find GT Employee.Salary
    
  • Remember that if you delete the main index for a related-to column, the relationship will no longer be valid for finding records.

See Also

SQL Indexes