Table constraint compare should ignore names


Great tool! It would be nice if the comparison ignored names of constraints so that system generated names for identical constraints don't get re-created in the script.

For example the diff generated by OCDB is giving me this:


even though there is no difference in the FK between the two DBs (other than the name of the FK).

My workaround is to go back to my scripts and stop using system generated names.



jspraul wrote Mar 5, 2012 at 6:09 PM

Thanks for this recommendation. My first impression is that standardizing the names by running the script once would mean the keys would have the same name for future comparisons... however, this could certainly be an optional feature (much like 'ignore column order').

One aspect of this issue might be making sure the generated scripts are specifying the names for what would otherwise be generated names for keys/indexes/etc.

jhess001 wrote Mar 6, 2012 at 1:18 AM

Looking through the code it looks like it might be some work and I wonder if others would find it useful. I've resorted to just running a script on my two DBs before running ocdb.exe that renames all FKs, PKs, UQs, and DFs to a common naming convention and this eliminates my problem. Thanks again!

jspraul wrote Sep 12, 2012 at 5:39 PM

Comment from an issue by CodePlex user MaiconMM closed as duplicate ( http://opendbiff.codeplex.com/workitem/15398 ):

"Since in some databases the PK name is auto-generated (actually I'm using NHibernate, and can't set the PK name). The comparison would work if the structure was checked but not the name. I tryed to do this change myself, it worked for comparing but not for code-generating. If someone could implement this it would be handy"

jspraul wrote Jan 24, 2013 at 6:47 PM

The following script might help someone with this issue to standardize their constraint naming convention:

Rename all Unique Constraints in a SQL Server database