|
Transact-SQL User's Guide
|
Comparing timestamp values
Use the tsequal system
function to compare timestamps when you are using browse mode in
a front-end application. For example, the following statement updates
a row in publishers that has been browsed.
It compares the timestamp column in the browsed
version of the row with the hexadecimal timestamp in the stored
version. If the two timestamps are not equal, you receive an error
message, and the row is not updated.
update publishers
set city = "Springfield"
where pub_id = "0736"
and tsequal(timestamp,0x0001000000002ea8)
Do not use the tsequal function
in the where clause as a search argument. When
you use tsequal, the rest of the where clause
should match a single row uniquely. Use the tsequal function
only in insert and update statements.
If a timestamp column is used as a search clause,
it should be compared like a regular varbinary column,
that is, timestamp1 = timepstamp2.