Table backup

  • I need to take a backup of a table into another database

    I tried to create a new backup table in database a using insert into from database b i.e.

    Insert into dbasea.tblbckup (col1,col2)

    select col1,col2 from dbaseb.tbl1

    However the problem here is that col2 is a timestamp field & hence is giving error

    Is there any other strategy to backup a table?

  • Do you care what the actual values of the timestamp field are? I can't imagine a case where you would, except where that's your method of generating a row identifier.

    If you do want to maintain the actual values in your source table's timestamp field then instead of creating the row in the "backup" table as a timestamp datatype create it as a binary datatype instead (from memory timestamp maps to a binary(8) field).

    If you don't need to maintain the actual value in your timestamp column but do want to maintain the timestamp datatype, change your select so it's only getting col1, and if you like order it by col2 so the rows get ascending timestamps as per the source table.

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

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