[dba-SQLServer] Merge records

jwcolby jwcolby at colbyconsulting.com
Sun May 27 12:55:13 CDT 2007


I have a situation where I might have several data records in a table (the
big 700 field table) that are about the same person / address but have
different data in some of the other fields.  These records represent answers
to surveys and so if a person answered three surveys, the person could have
three records in the database.  I need to merge the data from the three
records into a single record, and eventually delete the other two.

I have developed a field that represents the SHA1 hash of the address, zip5,
zip4, lastname and firstname.  I am running some tests to see whether this
hash is unique across 50 million records (unique to that name / address) but
I suspect that it will be.  Once I determine that it is, then I can use that
single field as a single "person identifier" field.

So I need pointers how to "merge" the data from one record into a second
record, only merging fields where there is legitimate data, and not
overwriting fields where there is already data.

John W. Colby
Colby Consulting
www.ColbyConsulting.com 




More information about the dba-SQLServer mailing list