SQL Server database (timestamp timestamp) type

Source: Internet
Author: User
Tags time and date

1. Exposes the data type of a unique binary number that is automatically generated in the database.

2.timestamp is typically used as a mechanism for adding a version stamp to a table row.

3. The storage size is 8 bytes. A non-nullable timestamp column is semantically equivalent to a binary (8) column. The nullable timestamp column is semantically equivalent to the varbinary (8) column. This will cause the timestamp type obtained in the C # program to become the byte[] type. So if we need to get and use this timestamp from the database, we have to go through the conversion.

The 4.timestamp data type is just an incremented number and does not hold the date or time. To record a date or time, use the datetime data type.

5. A table can have only one timestamp column. The values in the timestamp column are updated each time the row that contains the timestamp column is inserted or updated. Any updates to the row will change the timestamp value.

6. The use of cached data, timestamp records the time of the data change, the next time the value is larger than the last time, in the program read more than the last Max (timestamp) data, is the latest changed data

. Summary: The SQL Server timestamp data type is independent of time and date. SQL Server Timestamp is a binary number that indicates the relative order in which data modifications occur in the database. The implementation of the timestamp data type was originally intended to support the SQL Server recovery algorithm. Each time the page is modified, it is marked with the current @ @DBTS value and then @ @DBTS plus 1. This is sufficient to help the recovery process determine the relative order of page modifications, but the timestamp value has no relation to time. @ @DBTS Returns the last timestamp value used in the current database. When you insert or update a row that contains a timestamp column, a new timestamp value is generated.

SQL Server database (timestamp timestamp) type

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.