UPDATE

Changes data in EntitySets, relationships, forms, or sets.

Syntax

UPDATE [ALL] [SQLsetspec] SET «field = value » \
[WHERE clause [EVALUATE clause] [-> clause]

Parameters

ALL

Optional. Regardless of whether ALL is entered, all records in the set specification that meet the specified condition (if any) are updated.

SQLsetspec

An SQL set specification. Can contain application documents, EntitySets, relationships, forms, and sets. Role names are permitted.
If SQLsetspec is omitted, the current set is used (if it exists). Application documents named in the SQLsetspec may not be updated.

field

A target field in SQLsetspec.

value

Can be:
Any value expression.
The keyword NULL.
Field is assigned either the value of the expression, or the $Null property, as specified.
Any number of field = value assignments may be entered. If a field is not explicitly specified for update, its value remains unchanged.

Comments

The function of the UPDATE command is similar to that of the CHANGE command. UPDATE is able to update more than one database file in one command.

Example

update Employees set Salary = Salary * 1.1

change all Employees let Salary = Salary * 1.1

The preceding two commands are equivalent. Notice that, although the ALL has been omitted from the UPDATE command, it nevertheless updates all records that conform to the set specification.

update Employees, Departments \
 set Employees.Salary = Departments.StdSalary \
 where Employees.DNo = Departments.DNo

In the preceding command, the join condition appears in the WHERE clause. Notice that no relationship is needed.

 

Related Topics