INDEXEXISTS()

From Lianjapedia
Jump to: navigation, search

Purpose

Function to check whether index exists

Syntax

INDEXEXISTS(<expC1>, <expC2>, <expC3> [, <expC4>])

See Also

CLOSE DATABASES, COLUMNEXISTS(), CREATE DATABASE, DATABASE(), DATABASEEXISTS(), DBC(), DBF(), FILE(), OPEN DATABASE, TABLEEXISTS(), USE, USED()

Description

The INDEXEXISTS() function returns .T. if the index tag name specified in <expC3> exists for the table specified in <expC2> in the database specified in <expC1> and .F. otherwise. The optional <expC4> is to specify the key for the index: if included this must also match.

Example

if indexexists("southwind","customers","products","productid")
    open database southwind
    use products order productid
else
    open database southwind
    use products
    index on productid tag productid
endif