Need some guidance. Please help.

Discussion in 'MySQL' started by jfontestad, Jun 19, 2006.

  1. #1
    I have a MySQL database and I need to get all the information from that database and place it in another. The catch is that I would export it, but I need them to be place in a specific category depending on the table it comes from; from the original database.

    I'm guessing that there would need to be some sort of script involved that extracts the information from one database and places it in the other with its information just adds it the proper category. The way I was thinking about achieving the proper category issue is in the current database each table is a category, but in the new one all entries are in the same table, just now there is a category row.

    Looking for guidance on what can be done because I have run out of ideas. If you need further explanation just let me know.

    Thanks.
     
    jfontestad, Jun 19, 2006 IP
  2. kashem

    kashem Banned

    Messages:
    1,250
    Likes Received:
    76
    Best Answers:
    0
    Trophy Points:
    0
    #2
    what is the present table structures?

    and what is the target table structures?

    custom coding is neccessary
     
    kashem, Jun 19, 2006 IP
  3. JEET

    JEET Notable Member

    Messages:
    3,832
    Likes Received:
    502
    Best Answers:
    19
    Trophy Points:
    265
    #3
    Write a PHP script which reads data from original tables and INSERTS into new table category. Then put it in loop.
    You might have to "externally supply the table names" of the original table as you said that each data is a new table in old DB. Then use this table name to insert a record in new DB where name='$tablename'";
    ( Easier to write here than to code it...)
    best of luck.
     
    JEET, Jun 20, 2006 IP
  4. iconv

    iconv Well-Known Member

    Messages:
    189
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    108
    #4
    How about CREATE TABLE new_tbl SELECT *, 'newcolumncontent' FROM orig_tbl WHERE 1;

    Adjust the select query as necessary.

    If you need more complicated processing on a significant data set, don't use an online script, it will probably time out. Here's my suggestion for this scenario:

    1) Dump the db as an sql dump or csv file(s)
    2) Ceate a perl script to run over the dump that does the conversion you need and creates the new load file
    3) Test the result
    4) Upload the newly created load file into the new version of your db with mysqlimport or such
     
    iconv, Jun 25, 2006 IP
  5. copcally

    copcally Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    get it done by php script by using do/while loop or for loop call one by one from table and right the same in other.

    sorry i dont know php if u required in asp.net then i can provide you script
     
    copcally, Jul 14, 2008 IP