Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2004
    Location
    Rhode Island
    Posts
    69

    Unanswered: How to retrieve timestamp

    Can any one please tell me how to retrieve values from timestamp column.
    I am getting 1900-01-01 00:02:09.457. It is not storing current timestamp when record is created or modified.

    Is there anything I need to set it up.

    thanks

  2. #2
    Join Date
    Jul 2003
    Location
    SoCal
    Posts
    721
    Quote Originally Posted by smasanam
    Can any one please tell me how to retrieve values from timestamp column.
    I am getting 1900-01-01 00:02:09.457. It is not storing current timestamp when record is created or modified.

    Is there anything I need to set it up.

    thanks
    I don't believe the timestamp datatype actually contains a Date/Time, but instead, a unique binary number which represents an update to the row.

    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.
    If you need a field to hold date/time information, use the datetime or smalldatetime datatypes.
    That which does not kill me postpones the inevitable.

  3. #3
    Join Date
    Feb 2004
    Location
    Rhode Island
    Posts
    69
    If you need a field to hold date/time information, use the datetime or smalldatetime datatypes.
    =============================================

    System is in production now. Even though I create a column with datetime the program will not update the column. So I thought setting up a column which is being automatically updated.

    I like to delete some records based on the date last modified.

    Thanks

  4. #4
    Join Date
    Jul 2003
    Location
    SoCal
    Posts
    721
    This is right out of the SQL Server help guide:

    timestamp
    Is used to indicate the sequence of SQL Server activity on a row, represented as an increasing number in a binary format. As a row is modified in a table, the timestamp is updated with the current database timestamp value obtained from the @@DBTS function. timestamp data is not related to the date and time of an insert or change to data. To automatically record times that data modifications take place in a table, use either a datetime or smalldatetime data type to record the events and triggers.
    You'll never get actual date/time values from the timestamp datatype. You're going to have to change something if you want to know exactly when a row was last touched.
    That which does not kill me postpones the inevitable.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •