dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Custom Sync Tool

  1. #1
    Join Date
    Mar 2013
    Posts
    27

    Custom Sync Tool

    Hi

    How I can create one application that get results from one MS SQL Server query
    compare them with one MYSQL Server query and if it is equal then do update else do insert.

    For example, let say I have my source sql query
    Select ID, FName, LName From TBNames
    Results:
    ID | FName | Lname
    1 | John | Eaglin
    2 | Harry | Baggerly
    3 | Charlie | Abbett
    4 | George | Dent

    Then from Mysql query I have the result
    Select ID, fName, LName from MYNames where ID = {MSSQL_ID};
    ID | FName | Lname
    1 | John | Smith
    2 | Tomas | Ford

    I need to pass through ID field and update ID 1 and 2 from Smith to Eaglin
    from Tomas Ford to Harry Baggerly and insert the other 2 records.
    Running the same select on MYSQL I get the result
    ID | FName | Lname
    1 | John | Eaglin <-- Last Name changed
    2 | Harry | Baggerly <-- Both Names changed
    3 | Charlie | Abbett <-- Inserted
    4 | George | Dent <-- Inserted
    The problem is that queries are many with lot of different fields and tables.
    Is there any way I can pass fields names and results as variables to the update or insert query?

    Thank you
    Last edited by makis_best; November 27th, 2018 at 03:57 AM.

  2. #2
    DataMiser is offline Super Moderator Power Poster
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,302

    Re: Custom Sync Tool

    You should be able to do this with just queries, update table one from table two under whatever conditions and insert into table one from table two under whatever conditions. Hard to be more specific with only the info provided.
    Always use [code][/code] tags when posting code.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)