tsequal

Description

Compares timestamp values to prevent update on a row that has been modified since it was selected for browsing.

Syntax

tsequal(browsed_row_timestamp, stored_row_timestamp)

Parameters

browsed_row_timestamp

is the timestamp column of the browsed row.

stored_row_timestamp

is the timestamp column of the stored row.

Examples

Example 1

Retrieves the timestamp column from the current version of the publishers table and compares it to the value in the timestamp column that has been saved. If the values in the two timestamp columns are equal, updates the row. If the values are not equal, returns an error message:

update publishers
set city = "Springfield"
where pub_id = "0736"
and tsequal(timestamp, 0x0001000000002ea8)

Usage


Timestamping a new table for browsing


Timestamping an existing table

Standards

ANSI SQL – Compliance level: Transact-SQL extension.

Permissions

Any user can execute tsequal.

See also

Datatypes Timestamp datatype