Timestamp question

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
 
G

giorgio rancati

Hi Atlas,

In Microsoft Sql Server the timestamp field is a binary data type
 
S

Sylvain Lafontaine

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top