title: Swap values in a column in SQL Server table
body: <p>I am trying to update my tables data(1=>3, 2=>1, 3=>2) by swapping them using below queries.</p>
  
  <pre><code>/* Temporarily set 1 to a dummy unused value of 11 
     so they are disambiguated from those set to 1 in the next step */
  update &lt;tablename&gt; 
  set id = 11
  where id = 1
  
  update &lt;tablename&gt; 
  set id = 1
  where id = 2
  
  update &lt;tablename&gt; 
  set id = 2
  where id = 3
  
  update &lt;tablename&gt; 
  set id = 3
  where id = 11
  </code></pre>
  
  <p>Wondering if I can optimize my script.</p>