I'm wonder if it's safe to compare the values of timestamp in a table to get the newly updated/inserted rows. (e.g. SQL Server RowVersion/Timestamp - Comparisons).
What will happen if timestamp reaches the maximum value of binary(8) in a very very large/frequently updating database?
timestamp is the synonym for the rowversion data type and is subject to the behavior of data type synonyms. In DDL statements, use rowversion instead of timestamp wherever possible. For more information, see Data Type Synonyms (Transact-SQL).
ROWVERSION is just an incrementing number, it does not preserve date or time information. It be used to control concurrent access to the same rows. With SQL Server 2005, the CONVERT() function does not properly transform the hexadecimal string to a binary value.
Timestamp is a synonym for rowversion. Rowversion data type is not a date or time data type. Each database has a counter that is incremented for each insert or update operation that is performed on a table that contains a rowversion column within the database. This counter is the database rowversion.
You can use the @@DBTS function to get the current rowversion of a given database in SQL Server. More specifically, it returns the last-used rowversion value of the current database.
It won't.
If you do a million updates a second, every second, the timestamp will wrap around in about 585000 years.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With