hi all, just wondering if Sybase SQL Anywhere has a feature equivalent to SQL Server 2008's Change Tracking?
If not, is the timestamp column type with a DEFAULT TIMESTAMP the recommended approach for application level optimistic concurrency for SQL Anywhere?
I can't tell the real answer (simply since I have not used SQL Server's Change Tracking feature myself), however, to find out what rows have been changed lately (and by whom), it's a very common SA solution to provide each relevant table with a datetime column with DEFAULT TIMESTAMP (and possibly a char column with DEFAULT LAST USER). These columns are automatically updated each time the according rows are inserted or updated.
Note, in contrast to MS SQL/Sybase ASE, a DEFAULT TIMESTAMP is a real datetime/timestamp value and no binary "row version counter", so you can query for real date ranges. But it's not inherently used for optimistic conncurrency control - for these types, you can use the according API features or SQL statements with according FOR UPDATE BY VALUES/TIMESTAMP clauses - cf. this doc page on Updatable statements and concurrency control . - And note, these column defaults are defaults, i.e. if you update the row, you are still free to overwrite the values with whatever value you provide: Say, your table MyTable has an according dtLastChanged DEFAULT TIMESTAMP column, you can still do the following:
-- How to leave the DEFAULT TIMESTAMP unchanged... UPDATE MyTable SET Col2 = 'Test', dtLastChanged = dtLastChanged WHERE pk = 1;
For complete change tracking, note that SQL Anywhere has both