SQL Server creates constraints on existing data tables and uses with nocheck to avoid checking existing data.

Source: Internet
Author: User

When the foreign key constraint is added to an existing column in the table, the SQL Server 2005 database engine checks the existing data in the column by default, to ensure that all values except null exist in the referenced primary key or unique constraint column. However, by specifying with nocheck, the database engine can not check column data for new constraints and add new constraints without considering column data. If the existing data already meets the new foreign key constraint, or the business rule requires that the constraint be enforced only from then on, you can use the with nocheck option.

However, exercise caution when adding constraints instead of checking existing data, because this ignores the control used in the database engine to force table data integrity.

During the execution of insert and update statements, if the new data violates the constraints or constraints and should only be applied to the existing data in the database, the foreign key constraint should be disabled.

Operations in SSMs, such as setting

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.