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.

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.