xHarbour Reference Documentation > Command Reference xHarbour Developers Network  

SET UNIQUE

Includes or excludes non-unique keys to/from an index.

Syntax

SET UNIQUE on | OFF | ( <lOnOff> )

Arguments

on | OFF | ( <lOnOff> )
This option toggles whether records resulting in duplicate index entries are included in an index or not. The default is OFF or .F. (false), i.e. all records are included in an index. To change the setting use ON or .T. (true) as parameter. The parameter can also be specified as a logical expression enclosed in parentheses.

Description

The SET UNIQUE command determines how many records of a database, that result in the very same index value, are included in an index. With SET UNIQUE OFF, all records are included. When the setting is ON, a record is only included in an index when the index value of the record does not exist in the index. That is, an index value exists only once in an index.

SET UNIQE is a global setting valid for all work areas. It can be overridden for individual work areas with the UNIQUE option of the INDEX command.

Note:  It is important to understand that the SET UNIQUE setting affects indexes, not databases. It is possible to add, for example, the name "Miller" ten times to an address database. When the database is indexed on "LASTNAME" and SET UNIQUE is ON, only the first record containing "Miller" is added to the index. If this index is later selected as the controlling index, the remaining nine "Miller" records are not visible.

Info

See also:DbCreateIndex(), INDEX, OrdCreate(), PACK, REINDEX, SEEK, Set()
Category: Index commands , SET commands
Source:rdd\dbcmd.c, rtl\set.c
LIB:xhb.lib
DLL:xhbdll.dll


Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe