May 19, 2008 at 1:15 pm
Hello, I am trying to truncate a table that has foreign key relationships. I have 2 tables one has the primary key and the other has a fk relationship. When I alter the fk on the child table to NOCHECK I still can NOT truncate the parent table. Here is what is happening:
-- Parent table
ALTER TABLE OUTLET_GROUP NOCHECK CONSTRAINT ALL
go
-- Child table
ALTER TABLE CSAROLE NOCHECK CONSTRAINT ALL
go
TRUNCATE TABLE OUTLET_GROUP
go
-- Error Message.
Msg 4712, Level 16, State 1, Line 1
Cannot truncate table 'OUTLET_GROUP' because it is being referenced by a FOREIGN KEY constraint.
If I drop the fk on CSAROLE is works fine. Is there a way in SS 2005 to completely disable these constraints so I can truncate and reload the parent table? This works fine in Oracle. This is part of a daily datafeed process we run in Oracle and I need to support SS 2005 as well.
Thank you kindly for your help.
David
Best Regards,
~David
May 19, 2008 at 1:28 pm
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply