Select MAX with the Unix Timestamp field

Asked

Viewed 73 times

0

I have a database in which tables have a Timestamp column (column name) which is int type, where I store the value in Unix Timestamp format. I’m trying to give a select on the most recent date. However I do not know if it is possible to do this filtering with the value in Unix Timestamp format, or if it is necessary to do the conversion to Datetime.

I’m trying this way :

SELECT MAX (TimeStamp)

It’s been working so far, but I’m afraid the results were a coincidence. I wonder if I can make this select with the values in Unix Timestamp format, and it will actually return me to the most current date.

2 answers

2


Levi, since this is an int field, the MAX will suit you perfectly, can continue using this way.

0

Levi, in SQL Server the TIMESTAMP data type does not save date/time, as it is a database counter and is incremented for each insert or update operation executed in a table.

Details in ROWVERSION.

  • In the case Timestamp is the column name, I edited this in the question because I was implying that the field was a Timestamp.

  • @Levi Ok. Roger that.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.