Product Documentation

c-treeDB API for C# - Developers Guide

Previous Topic

Next Topic

Deleting an Index from a Table

If you need to delete one or mode indexes from a table, perform the following steps:

  1. Delete the index by calling CTTable.DelIndex(). There is no need to delete the index segments. Repeat this step for each index you want to delete.
  2. Call CTTable.Alter() to delete the index from the table.

// delete the first index

CTTable ATable = new CTTable(ADatabase);


// open the table

ATable.Open("MyTable", OPEN_MODE.NORMAL_OPEN);


// delete the first index - MyIndex0

ATable.DelIndex("MyIndex0");


// alter the table to commit index changes to disk

try

{

ATable.Alter(ALTER_TABLE.NORMAL);

}

catch (CTException err)

{

Console.Write("Alter table failed with error {0}\n", err.GetErrorCode());

}

TOCIndex