title: Add unique constraint to combination of two columns
body: <p>I have a table and, somehow, the same person got into my <code>Person</code> table twice. Right now, the primary key is just an autonumber but there are two other fields that exist that I want to force to be unique.</p>
  
  <p>For example, the fields are:</p>
  
  <pre><code>ID  
  Name  
  Active  
  PersonNumber  
  </code></pre>
  
  <p><strong>I only want 1 record with a unique PersonNumber and Active = 1.</strong><br>
  (So the combination of the two fields needs to be unique)</p>
  
  <p>What is the best way on an existing table in SQL server I can make it so if anyone else does an insert with the same value as an existing value, it fails so I don't have to worry about this in my application code.</p>