| DynamicQueryEngineManglePageSelectDQ2005 Method |
Namespace: SD.LLBLGen.Pro.DQE.SqlServer
protected virtual void ManglePageSelectDQ2005( IRetrievalQuery selectQuery, IEntityFieldCore[] selectList, IFieldPersistenceInfo[] fieldsPersistenceInfo, int rowsToSkip, int rowsToTake )
WITH __actualSet AS
(
SELECT *, ROW_NUMBER() OVER(ORDER BY CURRENT_TIMESTAMP) AS __rowcnt
FROM
(
-- if rowsToTake > 0
SELECT DISTINCT TOP (rowsToSkip + rowsToTake), projection of selectQuery
-- else (as the complete set to fetch has to be selected, there's no upper limited.
selectQuery
) AS _tmpSet
)
SELECT selectlist FROM __actualSet
WHERE __rowcnt BETWEEN startCnt AND endCount
ORDER BY __rowcnt ASC
And sortclause refers to the fields in the _tmpSet, instead of having the full order by again.