How to Read and Use Timestamp in MSSQL

APD Toronto
APD Toronto used Ask the Experts™
on
Hi Experts,

I have MSSQL 2008 R2 database table, which has a timestamp field, but I am wondering how can I read and use this in a WHERE clause?

A sample timestap is
0x0000000000035647

Thank you
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Scott PletcherSenior DBA
Most Valuable Expert 2018
Top Expert 2014

Commented:
You can't use it in any meaningful way.  It really doesn't have anything to do with time.  It's just a sequential counter.
APD TorontoSoftware Developer

Author

Commented:
I thought it was a date/time of when a record is changed?

If it is a sequential counter, does it update when a record is updated?
Scott PletcherSenior DBA
Most Valuable Expert 2018
Top Expert 2014

Commented:
SQL Server uses it internally as a unique counter.  That name is confusing -- the new name/data type is "rowversion", which is more accurate.
APD TorontoSoftware Developer

Author

Commented:
So I cannot use to find out which records were recently updated?
Senior DBA
Most Valuable Expert 2018
Top Expert 2014
Commented:
No, there is no reliable way to do that.  SQL controls that value.  And I believe it gets reset when SQL Server stops and restarts, although I'm not 100% sure of that.  At any rate, I'm virtually certain you can't be sure a higher value means a later time.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial