title: SQL Constraints Question
body: <p>In Sql Server 2005, I have a table with two integer columns, call them Id1 and Id2.
  I need them to be unique with in the table (easy enough with a unique index that spans both columns).  I also need them to be unique in the table if the values are transposed between the two columns.</p>
  
  <p>For example, SELECT * FROM MyTable returns</p>
  
  <pre><code>Id1   Id2
  ---------
  2     4
  5     8
  7     2
  4     2  &lt;--- values transposed from the first row
  </code></pre>
  
  <p>How do I make a constraint that would prevent the last row from being entered into the table because they are the transposed values from the first row?</p>