Synchronize dest table with source

  • Hi

    I am planning to set up replication between source and dest db's. But in case some mismatch arises i need to have a script which will compare the Destination table with Source and then synch up (if present update columns else insert). This script needs to be generated dynamicall given the table name. In oracle it is done by looking at user_tab_columns.

    1. What is the equivalent in SQL Server?

    2. Do any of you have a script to achieve the same?

    3. SSIS does it for one table. But i would still prefer to use the compare script because this is for a Terabyte table and i would prefer to insert some missing rows (say few GBs) rather than push the big table over the network.

    TIA

  • You can use information_schema.tables and information_schema.columns to get data about the database.

    In terms of figuring out what has changed, unless you have a good way to identify changed rows, I'm not sure what to tell you. There are products like Red Gate's Data Compare that can figure this out for you and are well tested.

  • gk-411903 (12/13/2009)


    Hi

    I am planning to set up replication between source and dest db's. But in case some mismatch arises i need to have a script which will compare the Destination table with Source and then synch up (if present update columns else insert). This script needs to be generated dynamicall given the table name. In oracle it is done by looking at user_tab_columns.

    1. What is the equivalent in SQL Server?

    2. Do any of you have a script to achieve the same?

    3. SSIS does it for one table. But i would still prefer to use the compare script because this is for a Terabyte table and i would prefer to insert some missing rows (say few GBs) rather than push the big table over the network.

    TIA

    When you are setting up a replication, wouldn't replication resolve the issue of mismatch itself? No doubt the table you are working on is extremely massively huge, but i think replication setup properly will take care of it.

    I have limited knowledge of replication in terms of dealing with this big datasets, if i am wrong please correct.

  • If you find that you need to compare rowsets to verify that data truly is in sync, then a third party tool like Steve suggested would be ideal.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

Viewing 4 posts - 1 through 3 (of 3 total)

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