UPDATE statement
640
♦
SQL/92 Syntax 1 is an entry-level feature, except for the FROM and
ORDER BY clauses, which are vendor extensions. Syntax 2 and 3 are
vendor extensions for use only with SQL Remote.
To enforce SQL/92 compatibility, ensure that the
ANSI_UPDATE_CONSTRAINTS option is set to STRICT.
$ For more information, see "ANSI_UPDATE_CONSTRAINTS
option" on page 171.
♦
Sybase Subject to the expressions being compatible, the syntax of the
UPDATE statement (syntax 1) is compatible between Adaptive Server
Enterprise and Adaptive Server Anywhere. Syntax 2 and 3 are not
supported.
♦ Transfer employee Philip Chin (employee 129) from the sales
department to the marketing department.
UPDATE employee
SET dept_id = 400
WHERE emp_id = 129;
♦ Sales orders currently start at ID 2001. Renumber all existing sales
orders by subtracting 2000 from the ID.
UPDATE sales_order AS orders
SET orders.id = orders.id - 2000
ORDER BY items.id ASC
This update is possible only if the foreign key of the
sales_order_items
table (referencing the primary key
sales_order.id
) is defined with the
action ON UPDATE CASCADE. The
sales_order_items
table is then
updated as well.
$ For more information on foreign key properties, see "ALTER
TABLE statement" on page 392 and "CREATE TABLE statement" on
page 466.
Standards and
compatibility
Examples