Unsupported Screen Size: The viewport size is too small for the theme to render properly.

Only Insert Data On Sync?

  • This topic is empty.
Viewing 2 reply threads
  • Author
    Posts
    • #9929
      cturner
      Member

      I'm using the latest version of SQLyog and trying to sync two local dbs. I'm using a where statement to only select rows in the source db that are marked “complete” in the status field to sync to the destination db. Can I somehow only insert records and not update records? I also have Navicat, and I can do an insert only on a sync, but I can't use a where statement. I want to be able to modify records in the destination db and not have them updated whenever I run the sync again.

      Thanks,

      Chris

    • #22653
      peterlaursen
      Participant

      No not possible. But you do not need a sync tool for this if I understand right. Plain SQL like

      Code:
      create table db1.newtable as
      select * from db1.oldtable
      union
      select * from db2.sourcetable where .. — here goes your where;
      rename table db1.oldtable to db1.trashtable;
      rename table db1.newtable to db1.oldtable;

      … will do. You can of course create a Notifications Service -job for it.

    • #22654
      peterlaursen
      Participant

      I forgot a detail:

      A table created with a 'select .. union .. select … ' construct does not have indexes. So you could include a ALTER TABLE statement that builds the indexes that you want.

      I you cannot write such ALTER TABLE statement you can do it from SQLyog GUI .. and copy the SQL from the HISTORY pane.

Viewing 2 reply threads
  • You must be logged in to reply to this topic.