• it is always best to provide table scripts, sample data and expected outcomes.

    BTW, did you review MERGE in Books Online? There are some VERY good examples there to guide you.

    Best,
    Kevin G. Boles
    SQL Server Consultant
    SQL MVP 2007-2012
    TheSQLGuru on googles mail service