Disable timestamp column to avoid automatic update.

  • I have the following problem,

    some tables have timestamp datatype.

    I would like to copy data to another database but with same structure.

    The problem is the timestamp, that is the only column different from equivalent tables between different database.

    Is it possible to disable timestamp to have same data after insert and update.

    Thank

     

     

  • It does not make any sense.

    Timestamp does not hold any useful information, so there is no point to copy it across.

    Only point of timestamp column - is to indicate if the row was changed since you have read it last time.

    So, it does not matter which value is in it, only changes of it do matter.

    _____________
    Code for TallyGenerator

  • Thank for your reply,

     

    I know that timestamp is used only to know if a rw is update, in fact timestamp is the only data not inserted/update (autogenerated by sql server), but the problem is that:

    data exported to other db (destination) must be update as well before to delete data on the source db.

    The only way to verify that data (source db) can be deleted is to verify that all data on these equivalent tables on both databases are syncronized (to avoid missing data).

    Otherwise I have to check column by column (I would like to avoid this).

    Or if possible ? to convert timestamp in another datatype and re-converted to timestamp for data comparison.

  • How do you "verify that all data on these equivalent tables on both databases are syncronized (to avoid missing data)"?

    _____________
    Code for TallyGenerator

  • If at the moment there is not solution about timestamp,

    as written, delete operation (joining equivalent tables) will be prerformed comparing col by col between equivalent tables (apart timestamp col).

     

     

  • TIMESTAMP is just a BINARY(8) value.  If you do not need the funtionality of Timestamp in the second database, create the columns as BINARY(8) instead of TIMESTAMP.  You can then insert the value of the timestamp into the binary(8) column and use it for your comparisons.

    Brian 

  • Thank to all,

    I have already thought about changing datatype to binary(8) but at the moment the column should maintain the same datatype. 

  • Hello,

    Is it possible to alter a timestamp column to binary(8)?, because doing it by TSQL is not possible, but I am able to alter the column by Enterprise Manager

     

    Thank

  • and how to insert timestamp data into binary field. With right conversion

    Thank

  • If you do it in EM, I believe it actually creates a new table, copies the data to it, drops the original, and then renames the new table and creates any indexes and keys that were on the original table.  You can run Profiler to see for sure.  Since timestamp is a binary field, you don't need to do any conversion to load it into a binary field. 

    Brian

  •  

    Hi tried to load data into a binary field, but values terminates with some 0 "zeros".

    How can I delete this "zeros" into the field or prevent this.

    thank

  • I have found out a strange behaviour, on sql server 2005 inserting timestamp on binary(8) data is correct, on SQL server 2000 the values has zeros at the end.

  • If you would open BOL you could find this in there:

    A nonnullable timestamp column is semantically equivalent to a binary(8) column. A nullable timestamp column is semantically equivalent to a varbinary(8) column.

    _____________
    Code for TallyGenerator

  • Thank

    for your contribution

Viewing 14 posts - 1 through 13 (of 13 total)

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