If Check Existing Data on Creation Or Re-Enabling is set to No, the foreign key does not check existing data when it is re-enabled.This would ensure the foreign key constraint is trusted. To trust the constraint by checking the existing data in the foreign key's relationship, select Check Existing Data on Creation Or Re-Enabling and select Yes from the drop-down menu. Select Enforce Foreign Key Constraint and select Yes from the drop-down menu. To re-enable the constraint when desired, reverse the above steps. In the grid under Table Designer, select Enforce Foreign Key Constraint and select No from the drop-down menu. Right-click the constraint and select Modify. In Object Explorer, expand the table with the constraint and then expand the Keys folder. Use SQL Server Management Studio To disable a foreign key constraint for INSERT and UPDATE statements Limitations and restrictionsĪfter you disable these constraints, future inserts or updates to the column will not be validated against the constraint conditions. Use this option if you know that new data will not violate the existing constraint or if the constraint applies only to the data already in the database. You can disable a foreign key constraint during INSERT and UPDATE transactions in SQL Server by using SQL Server Management Studio or Transact-SQL. SQL Server 2016 (13.x) and later Azure SQL Database Azure SQL Managed Instance Azure Synapse Analytics Analytics Platform System (PDW)
0 Comments
Leave a Reply. |