title: Parameterise values for OFFSET and FETCH NEXT
body: <p>Is there any way to do it ?</p>
  
  <p>I'd like to be able to run it as dynamic sql via <code>EXEC sp_executesql</code></p>
  
  <p>At the moment - it's just a string concatenation</p>
  
  <p>like so:</p>
  
  <pre><code>SET @sql += '
  ORDER BY em.[Date] ' + IIF (@sortOrder = 'asc', 'ASC', 'DESC') + '
  OFFSET ' + CONVERT (VARCHAR, @pageNum*@pageSize) + ' ROWS
  FETCH NEXT ' + CONVERT (VARCHAR, @pageSize) + ' ROWS ONLY'
  </code></pre>
  
  <p>Ideally, I'd like it to be: </p>
  
  <pre><code>SET @sql += '
  ORDER BY em.[Date] ' + IIF (@sortOrder = 'asc', 'ASC', 'DESC') + '
  OFFSET @offset ROWS
  FETCH NEXT @rows ROWS ONLY'
  </code></pre>