October 29, 2012 at 2:29 pm
We have a field (patient_info_ts) in our database that has a datatype of 'timestamp', however when we look at the data it appears to be in binary format. (examples: 0x0000000006729B60, 0x000000000660AAF4, 0x00000000068FFF96). How can I get that value to be a datetime or just a date?
Thanks!
October 29, 2012 at 2:44 pm
AFAIK, there's no way to convert a timestamp to datetime because there are no datetime values in the timestamp.
To avoid confusions, Microsoft has implemented the synonym rowversion.
Reference:
http://msdn.microsoft.com/en-us/library/ms182776(v=sql.90).aspx
October 29, 2012 at 2:50 pm
Luis Cazares (10/29/2012)
AFAIK, there's no way to convert a timestamp to datetime because there are no datetime values in the timestamp.To avoid confusions, Microsoft has implemented the synonym rowversion.
Reference:
http://msdn.microsoft.com/en-us/library/ms182776(v=sql.90).aspx
Luis is absolutely correct. They changed the name partly over confusion about what it does. This is a quote from the first paragraph in the article referenced above.
The timestamp data type is just an incrementing number and does not preserve a date or a time.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply