Timestamp question

  • Thread starter Thread starter Atlas
  • Start date Start date
A

Atlas

I'm discovering now that Timestamp fields aren't dates, but just unique
numbers.
Is that true or in those "unique numbers" there's a date part? Hope so,
'cause I would like, given the timestamp column, select groups of records
modified in a date range...
If this is possible what type of Convert/cast statement must i issue in the
Select?

Thanks
 
The Timestamps field is not a datetime field. To do what you want, you have
to add a new column of type datetime or smalldatetime with the following
default value: (getdate()) . The will display the creation date/time for
new records.

After that, you add a trigger that will update this field each time the
record is changed; something like:

CREATE TRIGGER MyTable_ModificationDate
ON dbo.MyTable
FOR UPDATE
AS

Update E
Set ModificationDate = getdate()
From dbo.MyTable T inner join Inserted ins on T.IdKey = ins.IdKey
 
Back
Top