Difference between date and timestamp in sqlserver?

What is the difference between Timestamp and Datetime SQL Server?

I thought that both formats are capable of storing date + time. Then where is the difference between the two?

But Timestamp cannot store information about the date, time.

What's the difference?

+62
date sql sql-server time
Aug 18 2018-11-11T00:
source share
2 answers

According to the documentation , timestamp is a synonym for rowversion - it automatically generates and guarantees 1 uniqueness. datetime not - it's just a data type that processes dates and times and can be specified by the client on the insert, etc.




1 Assuming you are using it correctly, of course. See Comments.

+69
Aug 18 2018-11-11T00:
source share

Datetime is a data type.

Timestamp is a method for managing string versions. In fact, in sql server 2008 this column type was renamed (i.e. Timestamp deprecated) to rowversion. This basically means that every time a line changes, this value increases. This is done using a database counter, which is automatically incremented for each inserted or updated row.

For more information:

http://www.sqlteam.com/article/timestamps-vs-datetime-data-types

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

+12
Aug 18 '11 at 9:25 a.m.
source share



All Articles