title: DBCC CHECKIDENT ('table', RESEED, 0) is causing he INSERT statement conflicted with the FOREIGN KEY constraint error
body: <p>I have one one parent table which has the id column with the Identity defined.</p>
  
  <pre><code>CREATE TABLE [model].[Parent](
  [Id] [int] IDENTITY(1,1) NOT NULL,
  [Name] [nvarchar](max) NOT NULL)
  </code></pre>
  
  <p>Now I have another child table table which refer parent Id column</p>
  
  <pre><code>CREATE TABLE [model].[Child](
  [Id] [int] IDENTITY(1,1) NOT NULL,
  [Name] [nvarchar](max) NOT NULL,
  [ParentId] [int] NULL)
  GO
  ALTER TABLE [model].[Child]  WITH CHECK ADD  CONSTRAINT [FK_ParentIdentity] FOREIGN KEY([ParentId])
  REFERENCES [model].[Parent] ([Id])
  GO
  </code></pre>
  
  <p>Both table has the id as primary key. Now the issue is when I am doing the migration I set the </p>
  
  <pre><code>DBCC CHECKIDENT ('[Model].[Parent]', RESEED, 0)
  DBCC CHECKIDENT ('[Model].[Child]', RESEED, 0)
  </code></pre>
  
  <p>I use the dynamic query to generate the insert statement.</p>
  
  <p>Now the when I insert the first row , I insert with the Null value in child table for Parent.id and get the following error :</p>
  
  <blockquote>
    <p>The INSERT statement conflicted with the FOREIGN KEY constraint "FK_ParentIdentity". The conflict occurred in database "DBName", table "model.Parent", column 'Id'.
    Checking identity information: current identity value 'NULL'.</p>
  </blockquote>
  
  <p>Can any one help me with this, I saw many solutions but did not help me. I don't have an option to delete the table and create it again.</p>