If you need to add one or more indexes to an existing table, perform the following steps:
// add new index to table
CTTable ATable = new CTTable(ADatabase);
// open the table
ATable.Open("MyTable", OPEN_MODE.NORMAL_OPEN);
// add the new index
ATable.AddIndex("MyNewIndex", KEY_TYPE.FIXED_INDEX, true, false);
// add new index segments
ATable.AddSegment("MyNewIndex", "Field1", SEG_MODE.SCHSEG_SEG);
// 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());
}