Jump to content


Photo

Copy Data Between 2 Tables


  • Please log in to reply
3 replies to this topic

#1 dirk mauroo

dirk mauroo

    Newbie

  • Members
  • Pip
  • 5 posts

Posted 22 February 2012 - 08:22 AM

I want to copy data between 2 identical tables. The 2 tables are in different database.
What is the easiest way to transfer data from one table to another ?


Thanks !

Dirk

#2 peterlaursen

peterlaursen

    Advanced Member

  • Admin
  • PipPipPip
  • 7,868 posts
  • Gender:Male
  • Location:Skagen, Denmark
  • Interests:well ... jazz/folk music, photography, chess, nature, ecology, history, bicycling, Highland Malts ... well, Lowland Malts and Cognac too actually :-) just wonder how I get the time to touch a computer! SQLyog and MONyog? no that's not interest, that's BASIC NEEDS simply!

Posted 22 February 2012 - 09:21 AM

Do you want to 'handpick' specific rows to be copied or do you want to take everything existing in one table and insert into the other (and vice versa) if not there already?
Computers make your grey hair come off ....

Peter Laursen
Webyog

#3 dirk mauroo

dirk mauroo

    Newbie

  • Members
  • Pip
  • 5 posts

Posted 22 February 2012 - 09:33 AM

I want to copy specific rows and complete tables.

#4 peterlaursen

peterlaursen

    Advanced Member

  • Admin
  • PipPipPip
  • 7,868 posts
  • Gender:Male
  • Location:Skagen, Denmark
  • Interests:well ... jazz/folk music, photography, chess, nature, ecology, history, bicycling, Highland Malts ... well, Lowland Malts and Cognac too actually :-) just wonder how I get the time to touch a computer! SQLyog and MONyog? no that's not interest, that's BASIC NEEDS simply!

Posted 22 February 2012 - 10:39 AM

1) to transfer specific rows:

We plan an interactive/visual 'mode' of Data Synchronization. Something like a 'diff editor' if you know such. It will likely take around 3 months to release. If the databases are on different servers I do not see any option (except for manually comparing and inserting) with SQLyog now. If databases are on same server a single SQL statement like:

INSERT [IGNORE] INTO .one_db.one_table .. SELECT .. FROM other_db.other_table ... [WHERE] ..

.. would do the job (details of how to frame the statement will depend on whether schemas are excatly the same). Refer MySQL documentation: http://dev.mysql.com...ert-select.html




2) transfer all rows

This is what we have Data Synchronization (in its current form) for.




Note: Data Synchronization is an ENTERPRISE/ULTIMATE feature.
Computers make your grey hair come off ....

Peter Laursen
Webyog




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users