SQL Server - Merging Two Tables with PK on both tables

  • Hello,

    I had a situation where we have two different DBs with Table-A (on DB1) & Table-B (on DB2). I have to merge both tables to a single new table (Table-C on DB1 or DB2 or NewDB).

    Here Table-A & Table-B are PK enabled & need the same on Table-C. Just want to know few suggestions/approaches on how to handle PK conflicts while in merging process.

    Brief questions:

    1) Approaches/suggestions to merge these tables.

    2) Approaches/suggestions to handle PK conflict records during this merge process.

    Kindly provide detailed explanation in doing this.

  • your requirement is basically De-normalization approach. First remove duplicate coluimn some time you need to merge the coluimn (concatenation of data like name = first name + last name )

    for Pk u need to see how data willl be uniquely defined means what are the columns good for PK candidate its not neccessary that old two table's coljumns will be used for PK.

    and for detail , post ur table defintion 😀

    -------Bhuvnesh----------
    I work only to learn Sql Server...though my company pays me for getting their stuff done;-)

Viewing 2 posts - 1 through 1 (of 1 total)

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