开发者

How to show timestamp's value as datetime

please tell me how to show the value of timestamp field of a table in datetime format (human understandable). and开发者_运维知识库 also how to use it in comparison while querying it.

Thanks


This can't be done. The TIMESTAMP datatype is misnamed - the name has been deprecated in favour of ROWVERSION in SQL 2008, which is a much clearer name.

TIMESTAMP stores an incrementing value which changes every time a row is updated.

If you want last updated dates stored against each row, you will need to add a DATETIME or SMALLDATETIME to your table and update it with the current date on each update.


You mean timestamp data type I think - http://msdn.microsoft.com/en-us/library/ms182776%28v=SQL.90%29.aspx

You can't convert it to datetime. According to the documentation in the link above :

> The timestamp data type is just an incrementing number and does not preserve a date or a time. To record a date or time, use a datetime data type.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜