| Author |
Message |
compvis
Joined: 02 Aug 2010 Posts: 9
|
Posted: Mon Aug 02, 2010 8:18 am Post subject: How to exclude tables of target database before sync? |
|
|
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 |
|
 |
peter.peartSite Admin
Joined: 02 Sep 2008 Posts: 362 Location: Top floor, RG towers with the cool kids
|
Posted: Tue Aug 03, 2010 5:08 pm Post subject: |
|
|
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 |
|
 |
compvis
Joined: 02 Aug 2010 Posts: 9
|
Posted: Wed Aug 04, 2010 2:09 am Post subject: |
|
|
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 |
|
 |
|
|
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