c# - Copying a large amount of rows between two tables in two different mysql databases -
I have a database, let's call it I have a SQL statement that raises data from Database A (approximately 1 million lines) and it needs to be inserted into database B. To read data from Database A, I am using a Whatever I have tried to do is iterative through each line in the data reader, and write the database with the simple INSERT stored procedure It is taking a very long time. I looked at the SQL Bulk Data Copy with C #, though I do not want to use external files. What options do I have? a simple query This is executed by MySQL engine directly by preventing any passage of data from MySQL and your code In a more complex scenario (for example, you need to repeat the operation and the target table is not present at the start) You can write a question like this < Pre> database A , and another
databaseb In MySQL
MySqlDataReader which has 1 million rows. Now I would like to write them in Database B.
select mysqldb1.table1 * mysqldb2 From .table2
string cmdText = "mysqldb1 Include in Table1 SELECT * mysqldb2.table2 "; (MySqlConnection cnn = Using MySqlConnection (.....)) (MySqlCommand CMD = New MySqlCommand (cmdText, cnn)) (cnn.Open ()); Int rows = CMD.exequintonquine (); Console.WriteLine (rows); }
string cmdText = @ "drop table if mysqldb1.table1; create table mysqldb1.table1 such as mysqldb2.table2; mysqldb1.table1 * from mysqldb2.table2"; (MySqlConnection cnn = New MySqlConnection (.....)) (MySqlCommand cmd = New MySqlCommand (cmdText, cnn)) {......}
Comments
Post a Comment