日期:2014-05-18  浏览次数:20541 次

实现数据库分页
SQL SERVER 2005中实现分页的SQL语句是什么呢?利用ASP.NET技术怎样在网页中实现分页?

------解决方案--------------------
select ceiling(2.1)
----方法1:
WITH UserInfos AS
(
select *,row_number() over(order by user_id) as RowNumber
from user_info
)
select *
from UserInfos
where RowNumber between 21 and 30

----方法2:
select * from
(
select *,row_number() over(order by user_id desc) as RowNumber
from user_info
) A
where RowNumber between 21 and 30

----方法3:
select top 10 * from user_info 
where user_id not in
(
select top 20 user_id from user_info 
order by user_id
)
order by user_id

----方法4:
SELECT TOP 10 *
FROM user_info
WHERE (user_id >
(SELECT MAX(user_id)
FROM (SELECT TOP 20 user_id
FROM user_info
ORDER BY user_id) AS T))
ORDER BY user_id

----方法5:
select *
from
(
select top 10 *
from 
(
select top 30 *
from user_info
order by user_id
) A
order by user_id desc
) B
order by user_id 







------解决方案--------------------
探讨

select ceiling(2.1)
----方法1:
WITH UserInfos AS
(
select *,row_number() over(order by user_id) as RowNumber
from user_info
)
select *
from UserInfos
where RowNumber between 21 and 30

----方……