Dela via


How to: Disable Check Constraints for Replication (Visual Database Tools)

In SQL Server, if a table is published using replication, check constraints are automatically disabled for operations performed by replication agents. When a replication agent performs an insert or update at a Subscriber, the constraint is not checked; if a user performs an insert or update, the constraint is checked. The constraint is disabled for the replication agent because the constraint was already checked at the Publisher when the data was originally inserted, updated. For more information, see Controlling Constraints, Identities, and Triggers with NOT FOR REPLICATION.

You can also explicitly disable check constraints for replication, which can be useful if you are publishing data from a previous version of SQL Server.

To disable a check constraint for replication

  1. In Object Explorer, expand the table with the constraint you want to modify, and then expand the Constraints folder.

  2. Right-click the constraint and then click Modify.

  3. In the Check Constraints dialog box, select a value of No for Enforce For Replication.

  4. Click Close.