how to only compare updates and inserts

Automate and integrate using the SQL comparison API

Moderators: Chris Auckland, David Atkinson, Michelle Taylor, chengvoon.tong

how to only compare updates and inserts

Postby b16b18 » Sat Jan 11, 2014 7:36 am

i want to do the equivalent of unchecking Target only for each table in SQL Data Compare which removes deleting records from the destination. I only want to deploy updates and inserts to the destination db. I've done this before with SDK 8 but I don't have access to the code I used anymore. What options do I set?
b16b18
 
Posts: 2
Joined: Sat Jan 11, 2014 7:33 am

Postby b16b18 » Sat Jan 11, 2014 6:58 pm

i think this will do it, can someone confirm?

session.CompareDatabases(db1, db2, mappings, SessionSettings.IncludeDifferentRecords And SessionSettings.IncludeRecordsInOne)
b16b18
 
Posts: 2
Joined: Sat Jan 11, 2014 7:33 am

Postby Brian Donahue » Mon Jan 13, 2014 3:39 pm

The current release of SDK uses an enum to specify the options, so to bind them together, you would use a bitwise or operation, or just plain "Or" in Visual Basic.
Code: Select all
session.CompareDatabases(db1, db2, mappings, SessionSettings.IncludeDifferentRecords Or SessionSettings.IncludeRecordsInOne)
This will compare and synchronize records in database 1 (the left database) and the different records that exist in both databases. Since it's ignoring records that only exist in database 2 (the right database), DELETEs should not be scripted.
Brian Donahue
 
Posts: 6669
Joined: Mon Aug 23, 2004 10:48 am


Return to SQL Comparison SDK 10

Who is online

Users browsing this forum: No registered users and 0 guests

cron