Link to home
Start Free TrialLog in
Avatar of RichardFox
RichardFox

asked on

Reading timestamp type

A select of a timestamp field just returns <binary>. How do I have a look at the values in human-readable form?

Thanks,

Rich
Avatar of Scott Pletcher
Scott Pletcher
Flag of United States of America image

A "timestamp" column does not actually contain a date-time.  In fact it has *no* relation to an actual date-time; it is more a binary counter of changes.  Thus, there is no way to convert it to its corresponding datetime.
Hi RichardFox,

There is no human-readable form of the timestamp field. This simply contains an 8-digit binary value that is guaranteed to be unique within a database, similar to a GUID but not as unique. It doesn't really have anything to do with time or date values. (Well that is the Microsoft version anyway, the SQL-92 standard does have a timestamp definition but this is represented in SQL server by the DateTime datatype.)



Tim Cottee
You're welcome to cast it to a bigint if you want but it won't provide you any more info than the binary version does.
Avatar of RichardFox
RichardFox

ASKER

OK thanks. I really fail to see the usefulness of such a data type, a timestamp that is not really a timestamp! If you need a unique counter, you can use a row id. What is this type's purpose?
ASKER CERTIFIED SOLUTION
Avatar of Scott Pletcher
Scott Pletcher
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Timestamp is not "unreadable". EM doesn't display any binary columns. Run you query in isqlw.exe, and you will see them.