SET KEY

From Lianjapedia
Jump to: navigation, search

Purpose

Restrict access to a set of records based on their index keys.

Syntax

SET KEY TO [<exp1> | RANGE <exp2> [, <exp3>] [IN <workarea>|<alias>]]

See Also

Getting Started: Instant Selections, INDEX, INDEXKEY(), INDEXORDER(), MDX(), NDX(), SEEK, SET FILTER, SET INDEX, TAG(), TAGCOUNT(), TAGEXPR(), TAGFOR(), TAGKEY(), TAGNO(), TAGUNIQUE(), USE

Description

The SET KEY command is used to limit the range of records you can access in a table. The table must be indexed, and the index key value or values you include must be the same data type as the index expression of the master index file or master tag.

<exp1>

If the <exp1> expression is specified, only records with a matching key are included in the selected records.

RANGE <exp2> [, <exp3>]

If the RANGE clause is specified, only records with a key equal to or greater than the <exp2> expression are included. If the optional <exp3> expression is also specified, only records with a key equal to or greater than <exp2> and equal to or less than <exp3> are included.

IN <workarea>|<alias>

If the optional IN clause is specified, the command operates in that workarea/cursor, otherwise in the currently selected workarea/cursor.


Issue SET KEY TO without any additional arguments to restore access to all records in the table.

Example

open database southwind
use products
set order tag productid
set key to range 20, 30
list
set order tag productname
set key to "Chai"
list
set key to range "A","C"
list