• If you're using SQL 2005 (as per the forum you posted in), then you do a two-state "upsert", which just means you do an update on matched records, and then an insert on unmatched records. It's really no more complex than that.

    If you're actually in 2008 by any chance, you can use Merge to do it all at once.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon