-- Remove constraint IF EXISTS(SELECT 1 FROM sys.foreign_keys WHERE name = 'FK_MyReferencedTable_MyTable') BEGIN ALTER TABLE dbo.MyReferencedTable DROP CONSTRAINT FK_MyReferencedTable_MyTable END -- Truncate table TRUNCATE TABLE dbo.MyTable -- Re-Add constraint IF NOT EXISTS(SELECT 1 FROM sys.foreign_keys WHERE name = 'FK_MyReferencedTable_MyTable') BEGIN ALTER TABLE dbo.MyReferencedTable WITH CHECK ADD CONSTRAINT [FK_MyReferencedTable_MyTable] FOREIGN KEY(ListingKey) REFERENCES dbo.MyTable (ListingKey) END