Getting foreign key constraint error when trying to repopulate a table…

DELETE FROM dbo.tbTable02;
GO

INSERT INTO dbo.tbTable02
...
ALTER TABLE [dbo].[tbTable01] 
DROP CONSTRAINT FK_tbTable01_tbTable02;

ALTER TABLE [dbo].[tbTable01]  WITH CHECK ADD  CONSTRAINT [FK_tbTable01_tbTable02] FOREIGN KEY([siTableID])
REFERENCES [dbo].[tbTable02] ([siTableID])
GO

ALTER TABLE [dbo].[tbTable01] CHECK CONSTRAINT [FK_tbTable01_tbTable02]
GO
Last modified: November 12, 2020

Author

Comments

Write a Reply or Comment