Options

Schema sync to ignore field changes

JamesJLangJamesJLang Posts: 3
edited November 1, 2006 6:58AM in SQL Toolkit Previous Versions
Hello All,
Here is what I am trying to do: compare and sync schema from one server to another. However, I do not want to make any changes that are only in server one. I thought that I could loop through each difference object and check the difference type, setting the selected property to false for anything that is OnlyIn1. This falls apart if I have a table in server one with a column that does not exist in the associated table in server 2. So if I have a new column in server one, it will get blown away by the sync. If I run from code, I can see that the difference is listed as "Different" and of type "Table", instead of "OnlyIn1" and "Field" like I was expecting. Does the compare not get that granular? Will I need to loop through all the columns in server 1 and manually compare the sets of columns (hopefully not because that is what I was expecting RedGate to do for me). Let me know if this makes sense, and if there is an easy solution to something like this. Also, if this is not what the "Field" ObjectType is used for, how is it used?

Thanks for the help! Great product!

Comments

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

    SQL Toolkit version 5's DataCompare.Engine namespace does have one carryover from version 4 that may be helpful, and that is the SessionSettings enumeration. This makes it very simple to exclude only the missing, additional, different, or identical records.

    For instance, SessionSettings.IncludeRecordsInTwo | SessionSettings.IncludeDifferentRecords would only compare and synchronize records that exist in both databases but are different, and also the records that exist in the second database but not the first.

    The SessionSettings enumeration is passed into the CompareDatabases method's final argument in order to limit the data compared and synchronized accordingly.
  • Options
    Hi Brian,

    Thanks for the response. However, that is in the DataCompare, while I am doing a schema compare. Would it be appropriate to use it this way? I dont want to copy any records across, just the schema, and want to leave any custom columns that have been created in environment 1 but not 2.

    This is trivial to do with all changes except for new columns, it appears.
  • Options
    Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    Hello James,

    I'm sorry I didn't get that right. Is this about excluding the changes that only involve certain columns? The SQL Compare engine does not have this level of granularity although there is a post by another user who created his own 'cloned' table objects to force SQL Compare's engine into creating certain scripts. Maybe this will make some sense to you?

    http://www.red-gate.com/messageboard/vi ... php?t=1082
This discussion has been closed.