Identity column comparison

CraighCraigh Posts: 3
Is it possible to configure a project such that a table can be compared on it's Identity column but then have that column excluded from the generated synch script?

I want to compare two databases to generate an update script for a third but am not interested in the IDs used for the primary key in the 3rd database in specific tables.

If I exclude Identity Columns in the Project Options I appear unable to define the remaining columns for comparison.



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

    From what I understand, the problem is that Data Compare always uses the comparison key to match rows of data. For instance, if you compared a table in two databases that turned out to be different, the resulting script would look like

    UPDATE table set column=value WHERE identity=x

    So the identity column, which I'm assuming is also your comparison key, must use the same values in both databases in order for Data Compare to work properly.
  • Options
    Thanks for your reply.

    The thing is, I do want to use the identity column to identify the differences between 2 tables (under my control e.g. v1 and v2) but when the Synch script is generated I just want to add the rows that were identified as being new to a 3rd table (end user v1 to take them to level v2).

    Basically, I need to ensure that a customer's table contains certain rows but I don't care what their Identity columns are and the customer may have added values of their own to that table.

    The only other way I could see of doing this would be to ignore the identity column completely and compare the other columns to identify the differences but I don't appear to be able to do this.

    Any suggestions on how I could get round this?
  • Options
    What you can do is compare using a custom comparison key in the Tables & Views tab of the project configuration. Click on the comparison key for the table you are interested in and change the comparison fields. Then you can remove the identity column from the columns in comparison and Robert's a close relative.

    Hope this helps.
    Richard Mitchell
    Project Manager
    Red Gate Software Ltd
Sign In or Register to comment.