Icon AddIndex Method

procedure AddIndex(const Name,Fields: String; Options:
      TIndexOptions=[]; const DescFields: String=''; Compression:
      TIndexCompression=icNone; NoKeyStatistics: Boolean=False)


Call the AddIndex method to create a new index for the table. The table may be open or closed when executing this method. If the table is open, then is must have been opened exclusively (Exclusive=True) or an exception will be raised.

The Name parameter is the name of the new index. The Fields parameter is a semicolon-delimited list of the fields to include in the index. The Options parameter is a potentially restricted set of attributes for the index:

ixPrimaryRepresents the primary index for a table.
ixUniqueRepresents a unique index which does not permit duplicate index key values. The primary index is always implicitly unique.
ixDescendingRepresents an index that sorts some or all fields in the index in descending order. The DescFields parameter controls which fields.
ixCaseInsensitiveRepresents an index that sorts without case-sensitivity.

The DescFields parameter indicates if you wish only certain fields in the index to sort in descending order. The Compression parameter indicates what type of index compression should be used for the new index.