Sqlserver2005的存储过程分页转换成Sqlserver 2000的
--createprocGetCoumterPage--@currentIndexint,--当前页--@pagesizeint,--显示的行数--@pageCounti...
--create proc GetCoumterPage
--@currentIndex int,--当前页
--@pagesize int,--显示的行数
--@pageCount int output--总页码数
--as
--declare
--@rowcount int
--set @rowcount=(select count(*) from Singles)
--if(@rowcount%@pagesize>0)
--set @pagecount =(@rowcount/@pagesize)+1
--else
--set @pagecount=@rowcount/@pagesize
--select*from
--(
-- select row_number() over(order by id asc) as rankid,id,title,[content],operating,photo,pdf,remark from Singles
--)
--as SinglesInfo where rankid >@currentIndex*@pagesize and rankid<=@currentIndex*@pagesize+@pagesize
这里的存储过程分页怎么转换成sqlServer2000的写法,急急 展开
--@currentIndex int,--当前页
--@pagesize int,--显示的行数
--@pageCount int output--总页码数
--as
--declare
--@rowcount int
--set @rowcount=(select count(*) from Singles)
--if(@rowcount%@pagesize>0)
--set @pagecount =(@rowcount/@pagesize)+1
--else
--set @pagecount=@rowcount/@pagesize
--select*from
--(
-- select row_number() over(order by id asc) as rankid,id,title,[content],operating,photo,pdf,remark from Singles
--)
--as SinglesInfo where rankid >@currentIndex*@pagesize and rankid<=@currentIndex*@pagesize+@pagesize
这里的存储过程分页怎么转换成sqlServer2000的写法,急急 展开
1个回答
展开全部
create proc GetCoumterPage
@currentIndex int,--当前页
@pagesize int,--显示的行数
@pageCount int output--总页码数
as
declare
@rowcount int
set @rowcount=(select count(*) from Singles)
if(@rowcount%@pagesize>0)
set @pagecount =(@rowcount/@pagesize)+1
else
set @pagecount=@rowcount/@pagesize
select identity(int,1,1) AS rankid,id INTO #t
From Singles
select*from
(
select rankid,a.id,title,[content],operating,photo,pdf,remark from Singles a inner join #t b on a.id=b.id
)
as SinglesInfo where rankid >@currentIndex*@pagesize and rankid<=@currentIndex*@pagesize+@pagesize
@currentIndex int,--当前页
@pagesize int,--显示的行数
@pageCount int output--总页码数
as
declare
@rowcount int
set @rowcount=(select count(*) from Singles)
if(@rowcount%@pagesize>0)
set @pagecount =(@rowcount/@pagesize)+1
else
set @pagecount=@rowcount/@pagesize
select identity(int,1,1) AS rankid,id INTO #t
From Singles
select*from
(
select rankid,a.id,title,[content],operating,photo,pdf,remark from Singles a inner join #t b on a.id=b.id
)
as SinglesInfo where rankid >@currentIndex*@pagesize and rankid<=@currentIndex*@pagesize+@pagesize
追问
为什么我用以下这句话:
“declare
@pageCounts int
exec GetCoumterPage 0,2,@pageCounts output”
执行了又报错了:无法使用 SELECT INTO 语句向表 '#t' 中添加标识列,该表中已有继承了标识属性的列 'id'。该怎么解决哦,#t是什么意思啊?是临时表吗?谢谢了哦
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询