[dba-SQLServer] Append only records where some fields not in the table already

jwcolby jwcolby at colbyconsulting.com
Thu Sep 3 09:32:38 CDT 2009


I have a set of 5 tables.  These tables contain names and number of children in age ranges.  As a 
first pass at processing, I need to merge the 5 tables into one table such that the name / address 
only gets into the table one time, IOW every record in the first table, but only the records in 
table 2 where the name / address data is not already in the destination table.

SQL Server 2005.  Clustered index on the name / address / zip5 / zip4 of the source tables.

I have not been able to find an append syntax that will append the records not in the table but 
prevent appending those already in, without aborting the entire append operation.

What is the magic key here?

-- 
John W. Colby
www.ColbyConsulting.com



More information about the dba-SQLServer mailing list