Link to home
Start Free TrialLog in
Avatar of ASPNET_8
ASPNET_8

asked on

TIME STAMP

Hi

 Can somebody pls tell me what is TimeStamp datatype in SQL Server.

Thanks

ASKER CERTIFIED SOLUTION
Avatar of Reubenwelsh
Reubenwelsh

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
timestamp

Is used to indicate the sequence of SQL Server activity on a row, represented as an increasing number in a binary format. As a row is modified in a table, the timestamp is updated with the current database timestamp value obtained from the @@DBTS function. timestamp data is not related to the date and time of an insert or change to data. To automatically record times that data modifications take place in a table, use either a datetime or smalldatetime data type to record the events and triggers.

Note  In SQL Server, rowversion is a synonym for timestamp.

timestamp variables are automatically populated by SQL Server with the time that a row is created or modified. The timestamp value is based upon an internal clock and does not correspond to real time. Each table may have only one timestamp variable.

You can  Understand By this example
CREATE TABLE [dbo].[tamstamptable](
      [c1] [int] NOT NULL,
      [c2] [int] NOT NULL
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[tamstamptable] ADD  CONSTRAINT [DF_tamstamptable_c1]  DEFAULT (@@dbts) FOR [c1]
GO




select * from [dbo].[tamstamptable]

insert [dbo].[tamstamptable](c2)
Values(2)
Avatar of ASPNET_8
ASPNET_8

ASKER

Good