IgnoreConstraintNames to ignore default unnamed constraints

Forum for users of SQL Compare schema synchronization utility

IgnoreConstraintNames to ignore default unnamed constraints

Postby bbilow » Tue Feb 07, 2012 3:29 pm

Hi, I have several default and unique constraints that were unnamed when they were created. by default SQL Server seems to assign them a hash name which causes conflicts when using sql compare.
I tried using IgnoreConstraintNames within my command line script but that didn't work. SqlCompare shows a difference like the example below.
UQ__cont__F43B3D3 - UQ__cont__42CB6785

Is there a way to force the constraint name to be the same hash name as before?
Posts: 2
Joined: Tue Dec 20, 2011 8:05 pm

Postby Michelle Taylor » Thu Feb 09, 2012 6:05 pm

You can specify an actual name for the constraint (e.g. 'col1 CONSTRAINT unique_constraint_x UNIQUE' instead of just 'col1 UNIQUE') when creating the constraint, but there's no global way to force SQL Server to change its automatic naming scheme.

IgnoreConstraintNames ought to have ignored constraint names during comparison (i.e. it won't flag the table as different if the only difference is the constraint name), but if there is another difference on the table then it will attempt to synchronize the constraint name when it synchronizes the table.

If you don't care what the constraint name is, this ought to be harmless (as it should also update any references to that constraint with the new name if you've included dependencies).
Michelle Taylor
Posts: 537
Joined: Mon Oct 30, 2006 11:45 am
Location: Red Gate Software

Return to SQL Compare Previous Versions

Who is online

Users browsing this forum: No registered users and 0 guests