开发者

When to use timestamp in sql 2008?

开发者 https://www.devze.com 2023-01-29 09:05 出处:网络
I read several times to convert the timestamp to any readable format but I am not able to decide when to use timestamp datatype or datetime datatype to keep track of开发者_Go百科 records inserted or u

I read several times to convert the timestamp to any readable format but I am not able to decide when to use timestamp datatype or datetime datatype to keep track of开发者_Go百科 records inserted or updated in database in sql server 2008.


timestamp is deprecated, do not use this type. Its role has been replaced by the rowversion type, which is a synonym for timestamp:

The timestamp syntax is deprecated. This feature will be removed in a future version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature.

As a type, timestamp (and rowversion) has absolutely no relation to dates, time or anything chronological:

The rowversion data type is just an incrementing number and does not preserve a date or a time.

If you need to track the time when a record was inserted or updated, use DATETIME2, at the desired precission.


Read detailed msdn article here

hope this will help you.

0

精彩评论

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