SQL Server 2005 中 ROW_NUMBER() 函数的简单分页用法
表名:d_ClientInfo
语句作用:取出第100-120条数据
SELECT *
FROM (SELECT ROW_NUMBER() OVER (ORDER BY ClientID ASC) AS ROWID, * FROM d_ClientInfo) AS tmpTable
WHERE ROWID BETWEEN 100 AND 120
FROM (SELECT ROW_NUMBER() OVER (ORDER BY ClientID ASC) AS ROWID, * FROM d_ClientInfo) AS tmpTable
WHERE ROWID BETWEEN 100 AND 120
此函数会为数据表重新编号并新建数据列ROWID,不需要的屏蔽掉就OK了。