Insert one row in the table as given below.
Listing 3
INSERT INTO MyTestTable([SmallDateTime],[DateTime])VALUES(GETDATE(), GETDATE())
Now open the table using SQL Server Management Studio or
executing SELECT query.
Listing 4
SELECT * FROM MyTestTable
The values in the table would be something like below. (In
your result set, data/time values will be your current date of the computer.)
Listing 5
RowID TimeStamp SmallDateTime DateTime
----------- ------------------ ----------------------- -----------------------
1 <span class=Bold>0x0000000000000FA1</span> 2008-09-20 02:27:00 2008-09-20 02:26:35.700
Though we had not inserted value in TimeStamp column, it has
one value. This value is nothing but a binary formatted value. Each insert of a
row in the table will automatically set the incremented
by 1 value in the TimeStamp column.
For example, insert another row in the MyTestTable by
executing the same insert query given above. Now open the table again. It would
have added a second row with a new TIMESTAMP value which is nothing but the
value incremented by one of pervious TIMESTAMP 0x0000000000000FA1.
Listing 6
RowID TimeStamp SmallDateTime DateTime
----------- ------------------ ----------------------- -----------------------
1 0x0000000000000FA1 2008-09-20 02:27:00 2008-09-20 02:26:35.700
2 <span class=Bold>0x0000000000000FA2</span> 2008-09-20 02:39:00 2008-09-20 02:38:39.763