Bug? - Ignore WITH NOCHECK

randyminder@yahoo.com[email protected] Posts: 30
edited September 21, 2007 6:22AM in SQL Compare Previous Versions
I did a SQL Compare between my scripts and a physical database. In one of my scripts I have the following statement:

ALTER TABLE [dbo].[ProjectAccount] WITH NOCHECK ADD
CONSTRAINT [FK_ProjectAccount_AccountGroup] FOREIGN KEY ([AccountRowID]) REFERENCES [dbo].[AccountGroup] ([RowID])

This constraint does not exist in the target database. SQL Compare correctly detected the constraint needed to be added but it left off the WITH NOCHECK argument when it created the T-SQL to add the constraint. In my compare options I have the 'Ignore WITH NOCHECK' checked.

It seems that even though the constraint is going to be added as new, since I've told SQL Compare to ignore WITH NOCHECK, it leaves the argument off in the synch script. My understanding was that the WITH NOCHECK option only applies when comparing constraints that exist in both the source and target, and if WITH NOCHECK is the only difference, it doesn't get flagged as a schema difference. It seems that this option also means that if the constraint is new, the WITH NOCHECK argument will not get included in the constraint. Is this a bug or working as designed?

Thanks - Randy

Comments

  • It's more of a side effect than 'as designed', but we decided it wasn't so awful as to hold off releasing with the new option which several people had requested. I've noted your forum post against the report and I'll prod the documentation people to make the behaviour clearer.
    Software Developer
    Redgate Software
Sign In or Register to comment.