I keep getting the error when running the code below:
Cannot truncate table 'Entry' because it is being referenced by a FOREIGN KEY constraint.
--ALTER TABLE [dbo].[Entry] DROP CONSTRAINT [PK_Entry_Id]
ALTER TABLE [dbo].[Entry] DROP CONSTRAINT [DF_Entry_HideChrome]
ALTER TABLE [dbo].[Entry] DROP CONSTRAINT [DF_Entry_IsDiscussionEnabled]
ALTER TABLE [dbo].[Entry] DROP CONSTRAINT [DF_Entry_MetaDescription]
ALTER TABLE [dbo].[Entry] DROP CONSTRAINT [DF_Entry_MetaTitle]
Truncate table [Entry]
ALTER TABLE [dbo].[Entry] ADD CONSTRAINT [DF_Entry_HideChrome] DEFAULT ((0)) FOR [HideChrome]
GO
ALTER TABLE [dbo].[Entry] ADD CONSTRAINT [DF_Entry_IsDiscussionEnabled] DEFAULT ((1)) FOR [IsDiscussionEnabled]
GO
ALTER TABLE [dbo].[Entry] ADD CONSTRAINT [DF_Entry_MetaDescription] DEFAULT ('') FOR [MetaDescription]
GO
ALTER TABLE [dbo].[Entry] ADD CONSTRAINT [DF_Entry_MetaTitle] DEFAULT ('') FOR [MetaTitle]
GO
ALTER TABLE [dbo].[Entry] ADD CONSTRAINT [DF_EntryStatus] DEFAULT ('Public-Page') FOR [Status]
GO
Ok so I dropped all other constraints from any tables referencing this table but I still get one more error saying there's still a PK constraint referencing my Entry table.
I go and check out the dependencies on Entry (view dependencies) and see that the comment table is still dependent on it:
Then I see there's a FK as one of the main fields of the comment table but you can't drop that I guess.
So I don't see what other dependencies are referencing this Entry table when View Dependencies says the only table left after I dropped constraints on the other tables is from the Comment table? I don't see it.