How to: Disable Check Constraints for Replication

You can disable a check constraint when your table is replicated in another database. When you replicate a table, the table definition and data are copied from the source database to a destination database. These two databases are usually (but not necessarily) on separate servers. If the check constraints are specific to the source database, they may unnecessarily prevent new data from being entered in the destination database. When you replicate a database at a remote site, you should not reapply check constraints because:

  • The integrity of the data was checked when it was entered into the original database.

  • The replication will fail if data violates the check constraints.

Note Note

Some databases have different functionality for check constraints. Consult your database documentation for details about how your database works with check constraints.

NoteNote

Your computer might show different names or locations for some of the Visual Studio user interface elements in the following instructions. The Visual Studio edition that you have and the settings that you use determine these elements. For more information, see Customizing Development Settings in Visual Studio.

To disable a check constraint for replication

  1. In your database diagram, right-click the table containing the constraint, then select Check Constraints from the shortcut menu.

    -or-

    Open the table containing the constraint, right-click in the Table Designer, and choose Check Constraints from the shortcut menu.

  2. In the Check Constraints dialog box select the constraint from the Selected Check Constraint list.

  3. In the properties grid change the value to No.

Community Additions

Show: