Update table with changes

  • Hi All

    I need a code to write data into another table if the data has changed from the source then update the destinaion

    Thanks

    It's better to fail while trying, rather than fail without trying!!!

  • An update trigger will do it nicely.

  • how about this?

    update distination

    set [Column] = c.col

    from (

    select case when a.[Column] <> b.[Column] then a.Colum else b.[Column] end as col

    from source a join destination b

    on a.id=b.id) as c

  • smthembu (11/2/2009)


    Hi All

    I need a code to write data into another table if the data has changed from the source then update the destinaion

    Thanks

    How about SSIS to achieve this.

    e.g. compare two tables, and extract the data changed into a staging table and then dump that data into base table.

    Hope this helps !

    \\K

    ______________________________________________________________________________________________________________________________________________________________________________________
    HTH !
    Kin
    MCTS : 2005, 2008
    Active SQL Server Community Contributor 🙂

  • Thanks for suggestions, i've used a script sent by hoosen.;-)

    It's better to fail while trying, rather than fail without trying!!!

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

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