title: How to add foreign key to an existing column in SQL Server 2012
body: <p>I am trying to add foreign key to my existing column using below query</p>
  
  <pre><code>ALTER TABLE Sub_Category_Master 
  ADD FOREIGN KEY (Category_ID) REFERENCES Category_Master(Category_ID)
  </code></pre>
  
  <p>but I'm getting an error </p>
  
  <blockquote>
    <p>The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "FK__Sub_Categ__Categ__5812160E". The conflict occurred in database "shaadikarbefikar_new", table "shaadikarbefikar.Category_Master", column 'Category_ID'.</p>
  </blockquote>