Click to See Complete Forum and Search --> : Best way to select data from database and put it in another database?


xvszero
08-28-2007, 09:43 AM
I'm trying to think of the best way to do this. In my mind the only ways I can think of are...

A. Do the select, then line by line read the input into a delimited text file, which I would then import into the new database...

or

B. Do the select, then somehow line by line read the data directly into the new database? But is this even possible? It would require having two connections at once, which I don't think is possible?

Are there any other ways to do this quickly and easily?

callumd
08-28-2007, 10:09 AM
Could you SELECT the data from the first database, and then put in to an array?

Then close that database connection, open the new database connection, and dump the contents of the array in to the database?

xvszero
08-28-2007, 12:47 PM
Oh yeah, that makes a lot more sense than writing to a text file, ha ha ha I'm stupid.

bokeh
08-29-2007, 12:13 PM
Could you SELECT the data from the first database, and then put in to an array?

Then close that database connection, open the new database connection, and dump the contents of the array in to the database?Only if the table is small otherwise you will run out of RAM.

The easiest way to do this is using a program like SQLyog

xvszero
08-29-2007, 12:15 PM
Well the tables will generally only have like 500 records or so, with 10-15 elements per record erm... it seems to be working, anyway.