Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

SQL Server - Merging Two Tables with PK on both tables Expand / Collapse
Author
Message
Posted Monday, October 22, 2012 2:01 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Yesterday @ 4:41 PM
Points: 3, Visits: 74
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.
Post #1375713
Posted Tuesday, October 23, 2012 5:50 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Today @ 12:15 AM
Points: 2,837, Visits: 3,957
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
Post #1375981
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse