title: Error with foreign key SQL Server 2012
body: <p>I have problem with adding foreign key in SQL Server 2012</p>
  
  <pre><code> create table Predracun
      (
      PredracunID int not null identity(1,1),
      Iznos nvarchar(255),
      Datum date,
      Opis nvarchar(255)
      )
  
  create table Racun
  (
  RacunID int not null identity (1,1),
  Sifra nvarchar(255),
  BrojRacuna nvarchar(255)
  )
  
  create table Prijem
  (
  PrijemID int not null identity (1,1),
  Datum date,
  Opis nvarchar(255)
  )
  
  alter table Prijem
  add constraint FK_PrijemPredracun
  foreign key (PredracunID)
  references Predracun (PredracunID)
  </code></pre>
  
  <p>added on this way</p>
  
  <p>and I got error msg</p>
  
  <blockquote>
    <p>Msg 1769, Level 16, State 1, Line 1
    Foreign key 'FK_UredjajPrijem' references invalid column 'PrijemID' in referencing table 'Uredjaj'.
    Msg 1750, Level 16, State 0, Line 1
    Could not create constraint. See previous errors.</p>
  </blockquote>