ContentsIndexPreviousNext

5.3.4 UPDATE Command

Use the SQL command UPDATE to modify one or more rows in a table and, depending on the configuration of the DSN, in the Vision data file.

Syntax

UPDATE <table-name>
SET <field-name> = <literal>
[,<field-name> = <literal> [, ...]]
[WHERE <condition>]

This command modifies the specified fields in all rows whose old values satisfy the WHERE condition. The format of the WHERE clause is the same as it is in the SELECT command. If there is no WHERE clause, all rows are modified.

If the WHERE condition is included, but no rows satisfy the condition, the command does nothing, and it does not report an error.

Example

Enter the following command to change Ellen Smith's city and state to Irvine, California:

UPDATE clients
SET city = 'Irvine', state_province = 'California'
WHERE owner = 'Ellen Smith'

The updated table looks similar to this:

odb00038.gif


Notes: You cannot change columns belonging to the primary key.

If a data source is designated as read-only and the data is linked, users cannot update information in the table, and therefore, in the data file. Read Only is the default setting. To enable users to update rows in the table, and records in the data file, clear the Read Only checkbox on the Advanced tab of the AcuODBC Configuration property sheet (or the AcuODBC Server Configuration property sheet if this is a remote DSN).