SET clause: Window syntax

Indicates which columns of a named window should be updated by the Update Window statement and specifies values for those columns.

Syntax

SET { value AS column [, ...] } | { column = value [, ...] }
Components

value

An expression that evaluates to a value of the same data type as the specified column.

column

The name of a destination column to which value is published.

Usage

The SET clause is used in an Update Window statement, where it indicates which columns in the destination named window (specified by the statement's UPDATE clause) should be updated when the trigger condition is met, and specifies values for those columns. If the statement includes a WHERE clause, the SET clause updates only the rows that meet the WHERE clause update condition. In the absence of a WHERE clause, the SET clause updates all the rows in the destination window.

The SET clause contains a comma-separated update list, which is specified in either of two syntax forms. In both forms, the update list is comprised of one or more items, each of which includes an expression, and an update-column-reference (note that the order of expression and update-column-reference is reversed in the two forms). Update list expressions can contain literals, column references from the streams or windows specified in the Update Window statement's ON and UPDATE clauses, operators, scalar and miscellaneous functions, and parentheses.

The update-column-reference associated with each expression must uniquely match a column name in the destination's named window schema, and the expression must evaluate to the column's data type. However, the update list does not need to contain a match for every column in the destination window's schema. Any columns not specified in the update list are left unchanged in the destination window. All rows affected by the SET clause receive a new row timestamp.

See Also

Examples

ON ReturnedOrders AS R 
UPDATE Orders AS O 
SET Shipped = FALSE, ShippedTime = NULL 
WHERE R.OrderID = O.OrderID;