Following is a table creating script created by Entity Framework using the model shown in https://codereview.stackexchange.com/questions/14077/is-it-proper-tpt-inheritance.In this script, there are two alter statements. What is the need for the second ALTER statement?SCRIPTCREATE TABLE [dbo].[SellingItems_Book]([Title] [nvarchar](max) NULL,[Id] [int] NOT NULL, CONSTRAINT [PK_SellingItems_Book] PRIMARY KEY CLUSTERED ([Id] ASC)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]) ON [PRIMARY]GOFirst Alter ALTER TABLE [dbo].[SellingItems_Book]  WITH CHECK ADD  CONSTRAINT [FK_Book_inherits_SellingItem] FOREIGN KEY([Id])REFERENCES [dbo].[SellingItems] ([Id])GOSecond AlterALTER TABLE [dbo].[SellingItems_Book] CHECK CONSTRAINT [FK_Book_inherits_SellingItem]GO
Why should I add CHECK CONSTRAINT?
.net;sql;sql server;entity framework
The second ALTER statement is superfluous because the WITH CHECK ADD will enable it. I believe they do that to make sure the check is enabled, which what the second statement does.