UPDATE

From Recital Documentation Wiki
Revision as of 10:31, 16 March 2009 by Yvonnemilne (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

UPDATE

Class

Fields and Records


Purpose

Update the contents of the active table with data from another table


Syntax

UPDATE ON <key expression> FROM <workarea | alias>

REPLACE <field> WITH <exp> [,<field> WITH <exp>...]

[RANDOM]


See Also

AVERAGE, COUNT, SUM, TOTAL, SET FILTER, SET RELATION


Description

The UPDATE command updates fields in the active table based upon data from another table. The <key expression> must exist in both tables. The active table must be indexed on the specified <key expression> unless the RANDOM keyword is specified. The FROM table can be in any order. If a FILTER <condition> is active in the FROM workarea, then only those records which satisfy the <condition> are processed. If SET DELETED is ON, then records which are marked for deletion in the FROM workarea are not processed.

It is strongly recommended that the active table be indexed on the <key expression>, otherwise ALL records satisfying the <key expression> values in the FROM file are updated in the active table, which can be a lengthy process. The UPDATE command is primarily used to update a 'master' file from records held in a 'transaction' file.


Example

select buse newpatrons alias newselect ause patrons index names, events, datesupdate on name from new;
replace balance with balance + new->balance


Products

Recital Database Server, Recital Mirage Server, Recital Terminal Developer