Difference between revisions of "SET UNIQUE"
Yvonnemilne (Talk | contribs) |
Helengeorge (Talk | contribs) |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
==Purpose== | ==Purpose== | ||
Determine whether duplicate keys are to be included in index files | Determine whether duplicate keys are to be included in index files | ||
Line 15: | Line 8: | ||
==See Also== | ==See Also== | ||
− | [[INDEX]], [[REINDEX]], [[UNIQUE()]] | + | [[APPEND]], [[CHANGE]], [[EDIT]], [[Function Keys]], [[INDEX]], [[ON ERROR]], [[REINDEX]], [[REPLACE]], [[SET PCUNIQUE]], [[UNIQUE()]] |
Line 27: | Line 20: | ||
==Example== | ==Example== | ||
− | < | + | <code lang="recital"> |
use patrons | use patrons | ||
set unique on | set unique on | ||
− | index on name to persons</ | + | index on name to persons |
+ | </code> | ||
==Products== | ==Products== | ||
− | Recital | + | Recital Server, Recital |
[[Category:Documentation]] | [[Category:Documentation]] | ||
[[Category:Commands]] | [[Category:Commands]] | ||
[[Category:Set_Commands|UNIQUE]] | [[Category:Set_Commands|UNIQUE]] | ||
+ | [[Category:Indexing]] | ||
+ | [[Category:Indexing Set Commands]] |
Latest revision as of 15:51, 25 November 2009
Purpose
Determine whether duplicate keys are to be included in index files
Syntax
SET UNIQUE ON | OFF | (<expL>)
See Also
APPEND, CHANGE, EDIT, Function Keys, INDEX, ON ERROR, REINDEX, REPLACE, SET PCUNIQUE, UNIQUE()
Description
If SET UNIQUE is ON when an index file is created or recreated, records with duplicate keys are discarded. The records still exist in the table, but there is no entry for them in the index file, so they are ’hidden’ from view. The unique status of the keys is stored in the index file, so whenever the index is associated with the table subsequently, the uniqueness of keys that are added to the index file is enforced.
If an attempt is made to add a duplicate key to a unique index file, the operation will not be able to complete. If a record is being appended or changed in the table through a full screen forms based command such as APPEND or CHANGE, then the system displays an appropriate message. The form cannot be exited until data entry is abandoned by pressing the [ABANDON] key, or a unique key is entered. If an attempt is made to update a record through the REPLACE command, an error message will be generated. This can be trapped with the ON ERROR command.
The UNIQUE keyword can also be included in the INDEX or REINDEX commands to provide the same effect as SET UNIQUE ON. By default, UNIQUE is OFF.
Example
use patrons set unique on index on name to persons
Products
Recital Server, Recital