Different Tables are Identical?
Beechams
Posts: 3
Hi,
I am experiencing some strange behaviour (from SQLCompare or me!). After comparing two SQL 2000 databases. I select a table that is showing as different and see in the comparison windows that they are identical. All the columns show an equals sign as does the PK.
The script that is generated only appears to drop and recreate an identical clustered primary key.
Sorry I can't post a screenshot.
Cheers
Beechams
I am experiencing some strange behaviour (from SQLCompare or me!). After comparing two SQL 2000 databases. I select a table that is showing as different and see in the comparison windows that they are identical. All the columns show an equals sign as does the PK.
The script that is generated only appears to drop and recreate an identical clustered primary key.
Sorry I can't post a screenshot.
Cheers
Beechams
This discussion has been closed.
Comments
I am assuming this is causing the two tables to appear as different, but is there an option to show this in the comparison window?
Cheers
Beechams
The engine that shows the differences in the lower text window is not as powerful as the one that creates the scripts. This is probably why this option is missing from the text window.
Regards
Dan
Red Gate Software Ltd
I've encountered this issue using the latest software because the primary key does not seem to adhere to the "ignore constraint and index names" option (or IgnoreConstraintNames when using the toolkit). I do not specify the optional constraint name for a primary key in a table, so it is different in each database.
All other constraint naming differences are ignored, and even this difference is correctly ignored in the "Creation SQL" script view. When a script is generated, however, the primary key is still dropped and re-added with the name from the source database (in SQL Compare 3.2.1.14 or even when using the IgnoreConstraintNames option in the BuildFromDifferences method of the Toolkit).
Hopefully I will be able to work around the issue in the toolkit by manually turning off this particular "difference" among my dbs until the issue is fixed.
Thanks,
Shane
I only experience this issue when other differences exist between two database tables besides different primary key names. Tables that are identical besides the primary key name result in "do nothing" scripts when I use the "ignore constraint and index name" option.
My primary key is unnecessarily dropped and re added when:
1. the pk names differ AND
2. other differences exist between the two tables (e.g., column widths) AND
3. index/constraint names are to be ignored
I'm sure the same thing happens when #3 is not selected, but in that scenario the behavior would be correct
It looks like I won't be able to disable this Difference in the Toolkit, as I want the other table adjustments to be included in the generated script.
Thanks again,
Shane
Example 1 - different primary key constraint name, plus other differences
db1.SomeTable
SomeTableID int identity primary key (constraint name PK_1)
OtherField varchar(10) unique (constraint name UQ_1)
db2.Sometable
SomeTableID int identity primary key (constraint name PK_2)
OtherField varchar(20) unique (constraint name UQ_2)
SQLCompare with "Ignore constraint and index names" option generates a script with two tasks:
1. drop/re-add the primary key constraint (incorrect)
2. resize OtherField (correct)
Example 2 - only difference is primary key constraint name
db1.SomeTable
SomeTableID int identity primary key (constraint name PK_1)
OtherField varchar(20) unique (constraint name UQ_1)
db2.Sometable
SomeTableID int identity primary key (constraint name PK_2)
OtherField varchar(20) unique (constraint name UQ_2)
SQLCompare with "Ignore constraint and index names" option generates a script with NO tasks (correct)