TimeStamp

  • Hello, I would like to add a timestamp column to my table. I was wondering if anybody knew the following questions?

    1) How much space would a timestamp column take?

    2) Could I use this column as a revision date? or is it only in binary and can't really be used for this?

    3) What if you BCP'd records in, would they all still have different timestamps?

    Thanks in advance. Ned.

  • You cannot use the timestamp column as a revision date.

    Timestamps are unique.

    From Books online:


    timestamp is a  data type that exposes automatically generated binary numbers, which are guaranteed to be unique within a database. timestamp is used typically as a mechanism for version-stamping table rows. The storage size is 8 bytes.

    Remarks

    The Transact-SQL timestamp data type is not the same as the timestamp data type defined in the SQL-92 standard. The SQL-92 timestamp data type is equivalent to the Transact-SQL datetime data type.

    A future release of Microsoft® SQL Server™ may modify the behavior of the Transact-SQL timestamp data type to align it with the behavior defined in the standard. At that time, the current timestamp data type will be replaced with a rowversion data type...


  • Try using a field of shortdatetime or datetime data type with a default of now() (or is it getdate()?).  That'll give you an insert time stamp, you can use an update trigger to alter the value whenever the record is changed.

    But timestamp is a specific data type with specific characteristics as Ron pointed out.  Both timestamp and datetime are 8 bytes, shortdatetime is 4.

    -----
    [font="Arial"]Knowledge is of two kinds. We know a subject ourselves or we know where we can find information upon it. --Samuel Johnson[/font]

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply