Red Gate forums :: View topic - How to exclude tables of target database before sync?
Return to www.red-gate.com RSS Feed Available

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

How to exclude tables of target database before sync?

Search in SQL Comparison SDK Previous Versions forum
Post new topic   Reply to topic
Jump to:  
Author Message
compvis



Joined: 02 Aug 2010
Posts: 9

PostPosted: Mon Aug 02, 2010 8:18 am    Post subject: How to exclude tables of target database before sync? Reply with quote

Hi,

I want to update data from database A (source) to database B(destination). I mean, not update data from B to A. How can i use code to exclude (custom) rows from B (target) before synchronizing data ? Like SQL Data Compare 8 software, please see image below:



Thanks
Back to top
View user's profile Send private message
peter.peart
Site Admin


Joined: 02 Sep 2008
Posts: 362
Location: Top floor, RG towers with the cool kids

PostPosted: Tue Aug 03, 2010 5:08 pm    Post subject: Reply with quote

Hi there,

Thanks for your post. This is actually quite simple. You need to supply a SessionSetting to the CompareDatabases method. e.g.

Code:
m_Session.CompareDatabases(db1, db2, mappings, SessionSettings.Default ^ SessionSettings.IncludeRecordsInTwo);


This will sync all rows, but remove the records that only exist in the target from the synchronization. i.e. It won't script any deletes.

HTH!

Pete
_________________
Peter Peart
Red Gate Software Ltd
+44 (0)870 160 0037 ext. 8569
1 866 RED GATE ext. 8569
Back to top
View user's profile Send private message Send e-mail
compvis



Joined: 02 Aug 2010
Posts: 9

PostPosted: Wed Aug 04, 2010 2:09 am    Post subject: Reply with quote

Thanks,

My example above is only one table on target. Assuming that i have two tables on target. How can i custom to select one of two tables ? With your code:

m_Session.CompareDatabases(db1, db2, mappings, SessionSettings.Default ^ SessionSettings.IncludeRecordsInTwo);

It means, i have to exclude all table from targets ?

Btw: the StatusEventHandler works fine with console samples but It doesn't work with winforms (i add a progress control to display pecentages). If possible, please upload a winform sample that successfully use StatusEventHandler and progress control.

Thanks for the best tools !
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