Disabled Foreign Key
Foreign keys are often disabled when bulk loading data into a table to improve performance. It's easy to forget to re-enable them after the event, meaning the foreign key doesn't get applied for any future updates or inserts.
💡 Aireforge Advisor can automatically generate a script for this.
- Re-enable the foreign key, if still needed. Note that re-enabling the foreign key will cause all table rows to be checked for integrity, so this should be considered when scheduling the SQL.
- Drop the foreign key if no longer needed.
How to Re-Enable Foreign Keys
ALTER TABLE dbo.TableName CHECK CONSTRAINT FK_dbo_TableName_TableNameID;
ALTER TABLE (Transact-SQL) | Microsoft Docs