title: The ALTER TABLE statement conflicted with the FOREIGN KEY constraint
body: <p>Why does  add a foreign key to the <code>tblDomare</code> table result in this error?</p>
  <blockquote>
  <p>The ALTER TABLE statement conflicted with the FOREIGN KEY constraint &quot;FK__tblDomare__PersN__5F7E2DAC&quot;. The conflict occurred in database &quot;almu0004&quot;, table &quot;dbo.tblBana&quot;, column 'BanNR'.</p>
  </blockquote>
  <p><strong>Code</strong></p>
  <pre><code>CREATE TABLE tblDomare
  (PersNR VARCHAR (15) NOT NULL,
  fNamn VARCHAR (15) NOT NULL,
  eNamn VARCHAR (20) NOT NULL,
  Erfarenhet VARCHAR (5),
  PRIMARY KEY (PersNR));
  
  INSERT INTO tblDomare (PersNR,fNamn,eNamn,Erfarenhet)
  Values (6811034679,'Bengt','Carlberg',10);
  
  INSERT INTO tblDomare (PersNR,fNamn,eNamn,Erfarenhet)
  Values (7606091347,'Josefin','Backman',4);
  
  INSERT INTO tblDomare (PersNR,fNamn,eNamn,Erfarenhet)
  Values (8508284163,'Johanna','Backman',1);
  
  CREATE TABLE tblBana
  (BanNR VARCHAR (15) NOT NULL,
  PRIMARY KEY (BanNR));
  
  INSERT INTO tblBana (BanNR)
  Values (1);
  
  INSERT INTO tblBana (BanNR)
  Values (2);
  
  INSERT INTO tblBana (BanNR)
  Values (3);
  
  ALTER TABLE tblDomare
  ADD FOREIGN KEY (PersNR)
  REFERENCES tblBana(BanNR);
  </code></pre>