select * from (
select row_number() over(order by id) as rowid,* from table where 1=1
) tt
select count(1) as countRow from (
select * from table where 1=1
sqlserver分页语句
原文:http://www.cnblogs.com/chang1/p/6933398.html