Compares two timestamp values and returns whether they are the same.
TSEQUAL ( timestamp1, timestamp2 )
timestamp1 Timestamp expression.
timestamp2 Timestamp expression.
The TSEQUAL function can only be used in a WHERE clause and is most commonly used as part of an UPDATE statement.
If timestamp1 is equal to timestamp2, a row has changed since it was fetched. If the row changed, its timestamp has been modified and the TSEQUAL function returns FALSE. When the TSEQUAL function returns FALSE, the application determines that no rows were updated and assumes that the row was modified by another user. The updated row is re-fetched.
You can use the TSEQUAL function to determine whether a row has been changed since it was fetched.
SQL/2003 Vendor extension.
Suppose you create a TIMESTAMP column Products.LastUpdated to store the timestamp for the last time the row was updated. The following UPDATE statement uses the TSEQUAL function to determine whether to update the row. If the value of LastUpdated is '2010/12/25 11:08:34.173226', the row is updated.
UPDATE Products SET Color = 'Yellow' WHERE ID = '300' AND TSEQUAL( LastUpdated, '2010/12/25 11:08:34.173226' );
|Send feedback about this page via email or DocCommentXchange||Copyright © 2008, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.0|