Options

Exclude a field for compare but get it in the script

QuertonQuerton Posts: 11
edited May 2, 2007 9:01AM in SQL Toolkit Previous Versions
Hi everyone,

Here is the situation I've the following table in 2 dbs:

Table1
CodeID - Null Not Allowed
CodeName - Null Not Allowed
CodeDescription - Null Not Allowed
CodeActive - Null Not Allowed

I need to compare data in the 2 db regardless the CodeActive value. So I can remove CodeActive from the mapping. But if a code is not present, the system need to add it.

The problem is the GetMigrationSQL give the insert command without the CodeActive (because excluded in the mapping I guess).

My question is: How can I ignore a field in the compare process but getting it in the insert command ?

(Hope I'm clear :))
Thanks a lot

Cheers

Comments

  • Options
    Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    Hi,

    I don't see a way of being able to exclude a column for comparison purposes, but include it in the synchronization script. Once you apply TableMappings to a ComparisonSession and compare the databases, the same session is given to the GetMigrationSQL method to get the SQL code.

    For that reason, I can't see how you could use different table mappings for the comparison and the script generation. It may be possible to come up with your own custom solution using ADO .NET.

    The SelectionDelegate may come in handy, for instance when you run the GetMigrationSQL method, you could check the row to see if it comes from the table in question, then use ADO .NET to select the row from the table and get the value of CodeActive and generate an update statement to add the missing column to the row.
Sign In or Register to comment.