社区
疑难问题
帖子详情
sql server 2000中,有2个字段为主键的表,怎样分页?
lokii
2007-04-18 10:39:14
K1为主键,第3页可以这样查
select top 10 * from tab1
where K1 not in
(
select top 10*(3-1) K1 from tab1
order by K1
)
order by K1
要是主键是(K1,K2)呢?
...全文
198
6
打赏
收藏
sql server 2000中,有2个字段为主键的表,怎样分页?
K1为主键,第3页可以这样查 select top 10 * from tab1 where K1 not in ( select top 10*(3-1) K1 from tab1 order by K1 ) order by K1 要是主键是(K1,K2)呢?
复制链接
扫一扫
分享
转发到动态
举报
AI
作业
写回复
配置赞助广告
用AI写文章
6 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
rainlovesea
2008-07-25
打赏
举报
回复
[Quote=引用 2 楼 zjcxc 的回复:]
sql 2005可以直接用rownumber函数
select * from(
select rid = row_number() over(order by k1, k2),*
from tab1
)a
where rid between 31 and 40
[/Quote]
钻石的,
tianhuo_soft
2008-07-25
打赏
举报
回复
[Quote=引用 4 楼 hery2002 的回复:]
..
[/Quote]
格拉
2008-07-24
打赏
举报
回复
看到四个钻石!
hery2002
2008-07-24
打赏
举报
回复
..
zjcxc
2007-04-18
打赏
举报
回复
sql 2005可以直接用rownumber函数
select * from(
select rid = row_number() over(order by k1, k2),*
from tab1
)a
where rid between 31 and 40
撸大湿
2007-04-18
打赏
举报
回复
declare @sqlstr nvarchar(4000), --查询字符串
@pagecount int,--第N页
@pagesize int--每页行数
select @pagecount=3--第3页
,@pagesize=10--第页10条
,@sqlstr='select * from sysobjects'
set nocount on
declare @P1 int,--P1是游标的id
@rowcount int
exec sp_cursoropen @P1 output,@sqlstr,@scrollopt=1,@ccopt=1,@rowcount=@rowcount output
select @rowcount as 总行数,ceiling(1.0*@rowcount/@pagesize) as 页数,@pagecount as 当前页
set @pagecount=(@pagecount-1)*@pagesize+1
exec sp_cursorfetch @P1,16,@pagecount,@pagesize
exec sp_cursorclose @P1
现在流行这个
软件测试和质量保证行业技术趋势分析.pptx
软件测试和质量保证行业技术趋势分析.pptx
全国电子商务自考网络营销与策划实践考核试题..doc
全国电子商务自考网络营销与策划实践考核试题..doc
网络安全综合实习报告.doc
网络安全综合实习报告.doc
高校网站安全及防护策略浅析.docx
高校网站安全及防护策略浅析.docx
scikit_learn-1.7.0-cp313-cp313t-macosx_10_13_x86_64.whl
该资源为scikit_learn-1.7.0-cp313-cp313t-macosx_10_13_x86_64.whl
疑难问题
22,302
社区成员
121,734
社区内容
发帖
与我相关
我的任务
疑难问题
MS-SQL Server 疑难问题
复制链接
扫一扫
分享
社区描述
MS-SQL Server 疑难问题
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章