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

帮我看看这些存储过程什么错
CREATE   PROC   sp_PageCount
        @pagesize   int
        ,@page   int
as
DECLARE   @pagetemp   int
set   @pagetemp   =   @pagesize*(@page-1)

select   top   @pagesize   *  
from   Orders  
where   OrderID   not   in   (select   top   @pagetemp     OrderID  
from   Orders   order   by   OrderID)
                order   by   OrderID

------解决方案--------------------
试试这个!!!!!!!!!不太清楚你的数据结构、
动态SQL
CREATE PROC sp_PageCount
@pagesize int,
@page int
as
DECLARE @pagetemp int
select @pagetemp = @pagesize*(@page-1) from Orders
exec ( 'select top '+@pagesize+ ' *
from Orders where OrderID not in (select top '+@pagetemp+ ' OrderID
from Orders order by OrderID) order by OrderID ')

谢谢先!~~~~~~~~~~~~~