Duplicating tables help.

Discussion in 'Databases' started by Lucky Bastard, Jun 7, 2006.

  1. #1
    I found this neat (well if I can solve my problem it would be neat) way of duplicating tables (either to another DB or same DB with different table name)
    CREATE TABLE destination_db_name.destination_table_name SELECT * FROM source_db_name.source_table_name
    Code (markup):
    Well it works EXCEPT it doesn't copy/duplicate the keys from source to destination table nor does it duplicate autoincrements (and next auto number).

    Does anyone know how to modify the slick SQL above to do this?
     
    Lucky Bastard, Jun 7, 2006 IP
  2. Slapyo

    Slapyo Well-Known Member

    Messages:
    266
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    108
    #2
    Have you tried.

    select * into destination_db_name.destination_table_name from source_db_name.source_table_name
    Code (markup):
     
    Slapyo, Jun 8, 2006 IP