title: Using OFFSET and FETCH with the ORDER BY clause and CASE clause together
body: <p>New to sql, I am trying to use ORDER BY clause with CASE and OFFSET FETCH together but always getting <code>Invalid usage of the option NEXT in the FETCH statement.</code> I want to order by col 1 based on an input and to only limit fetching 10 queries at a time. </p>
  
  <p>I've tried several formats but still get the same error. I've read some other stack overflow articles and the documentation but have been stuck for awhile. Would be grateful for any insight.</p>
  
  <p><code>SELECT...</code></p>
  
  <p>Option 1.</p>
  
  <pre><code>         CASE WHEN desc = 1 THEN col1 DESC END
           CASE WHEN desc != 1 THEN col1 ASC END
           END
           OFFSET 10 ROWS
           FETCH NEXT 10 ROWS ONLY
  </code></pre>
  
  <p>Option 2.</p>
  
  <pre><code>         CASE WHEN desc = 1 THEN col1 DESC END
           CASE WHEN desc != 1 THEN col1 ASC END
           OFFSET 10 ROWS
           FETCH NEXT 10 ROWS ONLY
  </code></pre>
  
  <p>Option 3.</p>
  
  <pre><code>         CASE WHEN desc = 1 THEN col1 DESC 
           OFFSET 10 ROWS
           FETCH NEXT 10 ROWS ONLY
           END
           CASE WHEN desc != 1 THEN col1 ASC 
           OFFSET 10 ROWS
           FETCH NEXT 10 ROWS ONLY
           END
  </code></pre>
  
  <p>Option 4.</p>
  
  <pre><code>         CASE WHEN desc = 1 THEN col1 DESC
           CASE WHEN desc != 1 THEN col1 ASC
           END
           OFFSET 10 ROWS
           FETCH NEXT 10 ROWS ONLY
  </code></pre>