Is TimeStamp column unique?

后端 未结 3 1686
别跟我提以往
别跟我提以往 2021-01-18 07:07

Is TimeStamp unique in all rows?

Does it have a unique index on it?

3条回答
  •  遥遥无期
    2021-01-18 07:39

    From the MSDN article, emphasis mine:

    Timestamp is a data type that exposes automatically generated, unique binary numbers within a database. timestamp is generally used as a mechanism for version-stamping table rows. The storage size is 8 bytes. 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.

    It also provides this interesting note:

    Duplicate timestamp values can be generated by using the SELECT INTO statement in which a timestamp column is in the SELECT list. We do not recommend using timestamp in this manner.

    In SQL server 2008 and later, the timestamp type has been renamed to rowversion, presumably to better reflect its purpose and value.

提交回复
热议问题