Can i use timestamp in order by to get records which are changed , inserted after old time stamp

  • Dear all,(sqlserver 2005)

    i want to save the largest timestamp in a variable then

    i want to get the changed and inserted record from a table

    like select * from t where timestamp>@timestamp

    is the above is correct ( basically i wanted timestamp to use in my stored proc which can

    get me differential from database)

    2) I could not under stand , how duplicate are getting created ,please tel me how it following is possible.(http://technet.microsoft.com/en-us/library/ms182776%28v=sql.90%29.aspx)

    Duplicate timestamp values can be generated by using the SELECT INTO statement in which a timestamp column is in the SELECT list. We do not recommend using timestamp in this manner.

    yours sincerely

  • The name timestamp is very badly chosen. It is a binary number, not an actual date.

    Given the issues with timestamp, wouldn't it be easier to just use an IDENTITY column? This simply increments for every new record.

    You can have gaps (if transactions fail for example), but as long as you don't mess with the column new values have always bigger values than the previous ones and duplicates do not occur.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

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

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