title: Null FK References caused a FK Constraint Error
body: <p>In a deployment, I had to rollback because the SQL caused a FOREIGN KEY CONSTRAINT error.  The table has millions of rows.  Can anyone see anything in this SQL that would cause that?</p>
  
  <p>I no longer have the original message handy like this:<br/></p>
  
  <blockquote>
    <p>FOREIGN KEY constraint "FSomeTable1"</p>
  </blockquote>
  
  <p>...it was literally VERY vanilla</p>
  
  <p><strong>OTHER INFORMATION:</strong><br/></p>
  
  <ul>
  <li>This was a NEW COLUMN</li>
  <li>The SEED DATA was to be executed in another script, so no data was in <code>tResult_Status</code> yet</li>
  </ul>
  
  <p><strong>TABLE DEFINITIONS:</strong><br/></p>
  
  <pre><code>CREATE TABLE [dbo].[SomeTable](
      [Claim_ID] [varchar](25) NOT NULL,
      ...other columns do exist...
      [Result_Status_Id] [uniqueidentifier] NULL,
  PRIMARY KEY CLUSTERED 
  (
      [Claim_ID] ASC
  )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [PRIMARY]
  ) ON [PRIMARY]
  
  CREATE TABLE [stp].[tResult_Status](
      [Result_Status_Id] [UNIQUEIDENTIFIER] NOT NULL CONSTRAINT [DResult_Status]  DEFAULT (NEWSEQUENTIALID()),
      [Result_Status_Name] [NVARCHAR](50) NOT NULL,
      [System_Value_Indicator] [BIT] NOT NULL,
      [Executed_By_Name] [NVARCHAR](400) NOT NULL,
      [Executed_Datetime] [DATETIME] NOT NULL,
   CONSTRAINT [PResult_Status] PRIMARY KEY CLUSTERED 
  (
      [Result_Status_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]
  </code></pre>
  
  <p><strong>DEPLOYMENT SCRIPT STATEMENTS:</strong><br/></p>
  
  <pre><code>ALTER TABLE [dbo].[SomeTable]  WITH CHECK ADD  CONSTRAINT [FSomeTable1] FOREIGN KEY([Result_Status_Id])
  REFERENCES [dbo].[tResult_Status] ([Result_Status_Id])
  GO
  
  ALTER TABLE [dbo].[SomeTable] CHECK CONSTRAINT [FSomeTable1]
  GO
  </code></pre>