What is difference between datetime and timestamp

Sql Server-2005

Sql Server-2005 Problem Overview


What is difference between datetime and timestamp datatype in Sql Server?.

Sql Server-2005 Solutions


Solution 1 - Sql Server-2005

One is a date and time, the other is a column type that is updated every time a row is updated.

[Note timestamp is being deprecated; use rowversion instead]

Solution 2 - Sql Server-2005

Timestamp (deprecated synonym for rowversion) :

> Is a data type that exposes automatically generated, unique binary numbers within a database. rowversion is generally used as a mechanism for version-stamping table rows. The storage size is 8 bytes. The rowversion data type is just an incrementing number and does not preserve a date or a time. To record a date or time, use a datetime2 data type.

http://msdn.microsoft.com/en-us/library/ms182776.aspx

Solution 3 - Sql Server-2005

Normally time-stamp used when ever you inserted new record into database automatically system would take default date time ex : transaction like bank deposit or with draw

data-time datatype used at the movement of inserting the user defined date into the record ex : date of birth

Solution 4 - Sql Server-2005

timestamp is the synonym for the rowversion data type and is subject to the behavior of data type synonyms. In DDL statements, use rowversion instead of timestamp wherever possible. In simple way to tell, It means the updating time of row. datetime means the time of creation of row. DateTime is constant and other is changeable as the real time and local time.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionDr. Rajesh RolenView Question on Stackoverflow
Solution 1 - Sql Server-2005Mitch WheatView Answer on Stackoverflow
Solution 2 - Sql Server-2005A. M.View Answer on Stackoverflow
Solution 3 - Sql Server-2005srikanth vaddellaView Answer on Stackoverflow
Solution 4 - Sql Server-2005Riaj FerdousView Answer on Stackoverflow