Skip to content

Instantly share code, notes, and snippets.

@seantunwin
Created February 7, 2019 14:54
Show Gist options
  • Select an option

  • Save seantunwin/c3bb6ba113b2f7ae61a33ebc3da23ef0 to your computer and use it in GitHub Desktop.

Select an option

Save seantunwin/c3bb6ba113b2f7ae61a33ebc3da23ef0 to your computer and use it in GitHub Desktop.
MSSQL: Get Range of Rows
SELECT
ROW_NUMBER() OVER (ORDER BY @id) AS num
[, columns]
FROM @table
WHERE
@id BETWEEN @start AND @end
ORDER BY @id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment