title: Using variables for asc and desc in order by
body: <p>I understand that I can use variables in the order by section of sql queries like this:</p>
  
  <pre><code>order by 
  case when @var1 = 'priority' then priority end desc,
  case when @var2 = 'report_date' then report_date end asc
  </code></pre>
  
  <p>But how do I use variables for the asc and desc sections too?</p>