I needed to alter the conditions of existing constraint - so I dropped it and recreated with the new conditions.
This failed, because there were 800k+ rows, that didn't meet the condition. That strikes me as odd, because
SELECT * FROM sys.[check_constraints] cc
Anyway, I recreated the constraint again, this time with hint
This time it passed and I expected
is_not_trusted to be
1, but it is still trusted.
Can someone explain it to me?
ALTER TABLE dbo.MyTable DROP CONSTRAINT CK_MyTable; GO ALTER TABLE dbo.MyTable WITH NOCHECK ADD CONSTRAINT CK_MyTable CHECK ( -- 7 conditions, mainly checking null and not null )