Red Gate forums :: View topic - How to copy data of new tables, along with schema?
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SQL Compare 10
SQL Compare 10 forum

How to copy data of new tables, along with schema?

Search in SQL Compare 10 forum
Post new topic   Reply to topic
Jump to:  
Author Message
v8maro



Joined: 29 May 2014
Posts: 1

PostPosted: Thu May 29, 2014 3:27 pm    Post subject: How to copy data of new tables, along with schema? Reply with quote

Using SC I'm trying to create a new table AND copy the data over, how do I do this? Example below:

DB1 (dev db)
T1
T2
T3

DB2 (prod db)
T1
T2

SC obviously gives me the differences between the two DB's, and as such I get a merge on T1 and T2, and a new create script on T3. However, T3 ha some static data in it that I need pushed to DB2. I tried to use SQL Data Compare and it states that there is nothing to compare it to so I cannot copy those rows.

How does one do this?

Also, to complicate it more, T3 now has a FK in T2. So a column is added to T2 with a default of ID 1(which ID 1 will exist in T3)...so when the merge script runs on T2, the T3 FK column should be populated with ID 1. How is this accomplished?

Thanks,

Steve
Back to top
View user's profile Send private message
Brian Donahue



Joined: 23 Aug 2004
Posts: 6649

PostPosted: Mon Jun 02, 2014 2:06 pm    Post subject: Reply with quote

Hi Steve,

First you have to push the change to the second database (CREATE TABLE T3). Once that is done, you should be able to use SQL Data Compare to compare and synchronize the tables.

If this does not work immediately, it's probably because T3 does not have a primary key or unique index that SQL Data Compare can use to identify unique rows of data (it shows up in "list of tables that could not be compared"). You can create a primary key on the table on both sides, or if schema modification is not allowed, you can go into SDC's Tables and Views and set a comparison key based on one or more columns there.

http://documentation.red-gate.com/display/SDC10/Selecting+tables+and+views

Hope this helps.
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