SELECT * FROM
(
SELECT *,
ROW_NUMBER() OVER (ORDER BY PK_ID) as rowNum
FROM
Limitations
- make a subquery
- ORDER BY is mandatory
Variant 2 (Sql server 2012 and upper)
SELECT * FROM
Limitations
- ORDER BY is mandatory to use OFFSET and FETCH clause.
- OFFSET clause is mandatory with FETCH. You can never use, ORDER BY … FETCH.
- TOP cannot be combined with OFFSET and FETCH in the same query expression.
- The OFFSET/FETCH rowcount expression can be any arithmetic, constant, or parameter expression that will return an integer value. The rowcount expression does not support scalar sub-queries.
No comments:
Post a Comment