gpt4 book ai didi

asp.net - 何时在 sql 2008 中使用时间戳?

转载 作者:行者123 更新时间:2023-12-02 14:15:08 25 4
gpt4 key购买 nike

我读了几次以将时间戳转换为任何可读格式,但我无法决定何时使用时间戳数据类型或日期时间数据类型来跟踪在 sql server 2008 的数据库中插入或更新的记录。

最佳答案

timestamp 已弃用,请勿使用此类型。它的角色已被rowversion取代。 type,它是时间戳的同义词:

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.

作为一种类型,timestamp(和rowversion)与日期、时间或任何按时间顺序排列的内容完全没有关系:

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

如果您需要跟踪插入或更新记录的时间,请使用 DATETIME2 ,达到所需的精度。

关于asp.net - 何时在 sql 2008 中使用时间戳?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4395397/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com