I have a table called PX_Child that has a foreign key on PX_Parent. I\'d like to temporarily disable this FK constraint so that I can truncate PX_Parent. I\'m not sure how
There is no such option to truncate table while foreign key constraint but we can use some trick like
ALTER TABLE [dbo].[table2] DROP CONSTRAINT [FK_table2_table1]
GO
truncate table [table1]
GO
ALTER TABLE [dbo].[table2] WITH CHECK ADD CONSTRAINT [FK_table2_table1] FOREIGN KEY([FKId])
REFERENCES [dbo].[table1] ([ID])
GO
ALTER TABLE [dbo].[table2] CHECK CONSTRAINT [FK_table2_table1]
GO