Sync tables

  • I have locally 2 tables the main, say tblMain, with an identity column called M_Id as a key and another tblSub having for key S_M_Id (foreign key from tblMain) and S_C_Id (foreign key from another table).

    The same tables exist on my hosting's server. I would like to sync those 2 tables, in other words all new records added to local tables will be copied to my hosting's server. I tried importing from my hosting's but as they are "holes" in tblMain (records can be deleted locally) it didn't work as I was expecting, I found out that locally I had 3100, 3102 and that imported gave 3100, 3101.

    How should I do this ? I need to run the sync manually about every week. Keep in mind that my SQL Server is located on a shared hosting environment where they are probably some restrictions.


    Jean-Luc
    www.corobori.com

  • Try to place a trigger on the source table that inserts new rows into the destination table. In order to do this you need to make a linked server connection first. But this may reduce performance.

    As a second option, you can make another table on your local and set the trigger to insert to that local table, and every week you can export those rows to destination table and delete the exported ones from the local table.

    Hope this helps,

    Zubeyir

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply