title: SQL server Order To with case and multiple columns
body: <p>I have SQL query with the following <code>ORDER BY</code> statement:</p>
  
  <pre><code>ORDER BY SName, DateEnrolledTo desc
  </code></pre>
  
  <p>I need to change this to</p>
  
  <pre><code>ORDER BY
  CASE WHEN @SortID='name' OR ISNULL(@SortID,'')=''
  THEN SName, DateEnrolledTo desc END,
  CASE WHEN @SortID ='Hroom' 
  THEN Hroom, DateEnrolledTo desc END  
  </code></pre>
  
  <p>The syntax for this is incorrect, can anybody tell me how to fix this? This only works if I only include 1 column. I couldn't find any questions that had this situation.</p>