Red Gate forums :: View topic - handling autoincremented primary keys and foreign keys
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
Data Compare for Oracle
Data Compare for Oracle forum

handling autoincremented primary keys and foreign keys

Search in Data Compare for Oracle forum
Post new topic   Reply to topic
Jump to:  
Author Message
alias2102



Joined: 10 Sep 2013
Posts: 1

PostPosted: Tue Sep 10, 2013 10:47 pm    Post subject: handling autoincremented primary keys and foreign keys Reply with quote

Hi, I was wondering if "Data Compare" handles foreign keys properly during synchronization. Here's what I mean. I have two databases DB1 and DB2. Each database has a table USERS with autoincremented primary key. This key is also present as a foreign key in another table ORGANIZATION in the same database. Both DB1 and DB2 have both tables present. How would Data Compare merge the data from both databases where primary keys are identical?
Let's say I have a USERS record In DB1 with primary key 1 and a USERS record with the same primary key value in DB2. What is going to happen to the primary keys and their corresponding foreign keys after the merge?
Back to top
View user's profile Send private message
Michael Christofides



Joined: 20 Apr 2011
Posts: 87
Location: Red Gate Software

PostPosted: Wed Sep 18, 2013 2:27 pm    Post subject: Reply with quote

Hi, sorry for the delayed response.

What is your desired behavior here? Depending on that you have a couple of options.

If the primary key could be the same for two records that you want to keep, you should set a different comparison key. By default we choose the Primary Key for this, but you can change it, details on how to do so here:
http://documentation.red-gate.com/display/DCO21/Selecting+tables+to+compare

If, however, the same primary key implies that you only want to overwrite the data in the target machine, simply keeping this row selected in the comparison results when you start the deployment wizard will result in a script which will alter that row.

In either case foreign keys will be respected.

Hopefully that helps, do say if we've misunderstood.

Michael
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group