SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


SQL Server - Merging Two Tables with PK on both tables


SQL Server - Merging Two Tables with PK on both tables

Author
Message
dasarishiva
dasarishiva
Forum Newbie
Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)

Group: General Forum Members
Points: 3 Visits: 140
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.
Bhuvnesh
Bhuvnesh
SSCertifiable
SSCertifiable (5.4K reputation)SSCertifiable (5.4K reputation)SSCertifiable (5.4K reputation)SSCertifiable (5.4K reputation)SSCertifiable (5.4K reputation)SSCertifiable (5.4K reputation)SSCertifiable (5.4K reputation)SSCertifiable (5.4K reputation)

Group: General Forum Members
Points: 5414 Visits: 4076
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 :-D

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


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search