I have several SQL Server 2005 databases with untrusted foreign keys. These keys are marked as "Not for Replication" (is_not_for_replication=1
) in the sys.foreign_keys
object catalog view.
I have run a script that captures these untrusted keys and runs
ALTER TABLE [tablename] WITH CHECK
CHECK CONSTRAINT [keyname]
against each key. For all but one the results say that these keys have been validated (re-trusted?), but the sys.foreign_keys
view still has them marked as untrusted.
Why is this object catalog view not reflecting the "re-trusted" keys as is_not_trusted=0
? Is a "Not for Replication" foreign_key always untrusted? If not, how do I get the catalog view to reflect the "trusted" state of the foreign key?
Also, am I correct in assuming that as long as the foreign key is marked as "untrusted" it will not be factored in to any SQL Server execution plan?
Thanks for any comments or suggestions.