dormky 4 Posted Monday at 06:28 AM So I need to copy the contents of one table to another database. But it seems changing the Connection on a TMyQuery erases the data stored in it. Any alternatives that do not require creating a TMyTable ? Share this post Link to post
Lajos Juhász 325 Posted Monday at 06:51 AM Do you need a universal aproach or on a specific setup? If you need for a specific case you should check out how your server implements insert into select between two databases. Share this post Link to post
dormky 4 Posted Monday at 07:41 AM 49 minutes ago, Lajos Juhász said: Do you need a universal aproach or on a specific setup? If you need for a specific case you should check out how your server implements insert into select between two databases. The databases aren't on the same server. Obviously if that was the case this would be trivial Share this post Link to post
Lajos Juhász 325 Posted Monday at 08:18 AM Depending the servers you are using to could be still possible. Share this post Link to post
dormky 4 Posted Monday at 09:06 AM 46 minutes ago, Lajos Juhász said: Depending the servers you are using to could be still possible. You mean that MySQL can transfer data directly from one server to the other ? I'm not talking about doing replication, this is for select rows Share this post Link to post
BertB 2 Posted Tuesday at 06:47 AM If you open TMyQuery when connected to a database and then close and change the connection, all data in TMyQuery will be lost. You need a Connection and Query component to database A (MySQL for example), and you need a Connection and Query component to database B (PostgreSQL for example). Then you have to iterate the records in the table of database A and insert them in database B with 'INSERT INTO' statements. Share this post Link to post
weirdo12 26 Posted 22 hours ago As was said above, you just need to connect to both servers (databases) simultaneously. You should have a look a using some of the built-in functionality you get with MyDAC - like TCRBatchMove. Let it do all the tedious INSERT work for you. https://docs.devart.com/mydac/devart.dac.tcrbatchmove.htm Share this post Link to post