Efficient way of getting @@rowcount from a query using row_number

后端 未结 4 1338
-上瘾入骨i
-上瘾入骨i 2020-12-04 08:37

I have an expensive query using the row_number over() functionality in SQL Server 2005. I return only a sub list of those records as the query is paginated. However, I wou

4条回答
  •  暖寄归人
    2020-12-04 09:23

    I do this by putting the whole resultset with the row_number into a temp table, then use the @@rowcount from that and use the query on that to return the page of data I need.

提交回复
热议问题