Red Gate forums :: View topic - Sychronize data for only a few of the database tables
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SQL Toolkit Previous Versions
SQL Toolkit Previous Versions forum

Sychronize data for only a few of the database tables

Search in SQL Toolkit Previous Versions forum
Post new topic   Reply to topic
Jump to:  
Author Message
jmei



Joined: 03 Dec 2007
Posts: 4

PostPosted: Mon Dec 03, 2007 6:17 pm    Post subject: Sychronize data for only a few of the database tables Reply with quote

Hi,

I am trying to use API to synchronize table data for only a few of the database tables.

I set the RefreshSelected property to true on the TableDifference objects for those tables I want to sychronize, and set to false for other tables I don't want to sychronize. But when I generate the block using SqlProvider.GetMigrationSQL, the data in all tables in the database are synchronized.

I only want to sychronize data for a few tables in the database. How can I complete this task?

Thanks


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



Joined: 23 Aug 2004
Posts: 6677

PostPosted: Mon Dec 03, 2007 6:28 pm    Post subject: Reply with quote

Hi J,

It's possible to select a subset of tables to compare and synchronize by looping through the automatically-generated table mappings (created with the CreateMappings method in the sample code) and setting each mapping's 'Include' property to true or false depending on whether or not the mapped tables or views should be synchronized.

You can see an example here.
Back to top
View user's profile Send private message
jmei



Joined: 03 Dec 2007
Posts: 4

PostPosted: Tue Dec 04, 2007 9:52 pm    Post subject: Sychronize data for only a few of the database tables Reply with quote

Hi Brian,

Thank your for your response.

It seems that the include proporty for mappings does not work for me. I nodified my code, and set the include property to true for those tables I want to synchronize and to false to those tables I don't want to sychronize. I traced the run, the include properties were set correctly as what I wanted, but all tables were still synchronized. The block had script all table data.

Any thing I missed?

Thank you.


J.
Back to top
View user's profile Send private message
jmei



Joined: 03 Dec 2007
Posts: 4

PostPosted: Wed Dec 05, 2007 12:04 am    Post subject: Sychronize data for only a few of the database tables Reply with quote

Hi Brian,

I have solved the problem. I set the include property after the CompareSession, incorrectly. I have fixed it. And it worked.

Thanks,


J.
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