TSQL获取下一行数据?

时间:2021-12-14 09:26:46

Normally we use the TSQL TOP to get first number of rows of data like this:

通常我们使用TSQL TOP来获取第一行数据,如下所示:

SELECT TOP 10 * FROM myTable;

I am not sure if there is any way to get the next 10 and next 10, ... till to the end, just something paging. I cannot figure out. May be CTE statements?

我不确定是否有任何方法可以获得下一个10和下一个10,...直到最后,只是寻呼。我想不出来。可能是CTE声明?

1 个解决方案

#1


Here's a solution using row_number() in SQL Server 2005:

这是在SQL Server 2005中使用row_number()的解决方案:

Paging Records Using SQL Server 2005 Database - ROW_NUMBER Function

使用SQL Server 2005数据库分页记录 - ROW_NUMBER函数

... and here's the Google-search I used to find it:

...这是我以前找到的谷歌搜索:

row_number() over paging

row_number()超过分页

#1


Here's a solution using row_number() in SQL Server 2005:

这是在SQL Server 2005中使用row_number()的解决方案:

Paging Records Using SQL Server 2005 Database - ROW_NUMBER Function

使用SQL Server 2005数据库分页记录 - ROW_NUMBER函数

... and here's the Google-search I used to find it:

...这是我以前找到的谷歌搜索:

row_number() over paging

row_number()超过分页