Jump to content

Convert SQL Server timestamp (ts) binary to string?


benphp

Recommended Posts

Which SQL server type?

 

Also, posting an example showing what you are doing, what result you are getting, and what result you expect would help.

 

In mysql the only 8 byte date/time is a DATETIME data type and referencing it in a string context returns a 'YYYY-MM-DD HH:MM:SS' string. Referencing it in a numerical context returns a YYYYMMDDHHMMSS value.

Timestamp datatype is stored in 8 bytes as binary(8) datatype. The timestamp value is automatically updated every time a row containing a timestamp column is inserted or updated.

 

Timestamp value is a monotonically increasing counter whose values will always be unique within a database and can be selected by queried global variable @@DBTS.

 

---

Example:

Select  Grade, ts From class_Students WHERE CID = '1677'

 

results:

 

Grade = P

ts = V

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.