SQL Server has a less known datatype called “ TimeStamp ”. But I wasn't able to find any article about it on the web. So I thought I would try a sample myself and write about it. TimeStamp is actually used for record versioning in a table. When you Insert (or) Update a record in a table with a TimeStamp field, that field gets updated automatically. Lets create a sample table to understand the usage of TimeStamp field. Create table TimeStampExample ( RunningNumber int identity, LastName varchar(30), tStamp timestamp ) The above table “TimeStampExample” has been created with a TimeStamp field (tStamp). By the way its not mandatory to provide a field name for timestamp columns. The below table structure is perfectly valid only. Create table TimeStampExample ( RunningNumber int identity, LastName varchar(30), timestamp -- note we haven't mentioned a field name here ) When a record is inserted the value of tStamp gets automatically set by SQL Server. Lets see that in action. Insert...
I write about things which I am passionate about.