if exists(select * from sysobjects where name='Sys_IllAll_Pagination')
drop procedure Sys_IllAll_Pagination
goalter procedure Sys_IllAll_Pagination
@pageNumber int
as
select top 10 * from t_ill_info 
where idx not in (select top ((@pageNumber-1)*10) idx  from t_ill_info)
goexec Sys_IllAll_Pagination @pageNumber=3不知道为什么错误,exec Sys_IllAll_Pagination @pageNumber=3这句话说找不到Sys_IllAll_Pagination 存储过程,然后查询的时候就只能加载出前10项,永远都是前十项,而没有进行分页的不知道是什么错误,已经有半年多没有写过这写东西了

解决方案 »

  1.   

    if exists(select * from sysobjects where name='Sys_IllAll_Pagination')
    drop procedure Sys_IllAll_Pagination
    gocreate  procedure Sys_IllAll_Pagination
    @pageNumber int
    as
    select top 10 * from t_ill_info  
    where idx not in (select top ((@pageNumber-1)*10) idx from t_ill_info)
    go
      

  2.   

    exec Sys_IllAll_Pagination 3
      

  3.   

    SELECT TOP 页大小 *
    FROM table1
    WHERE id NOT IN
              (
              SELECT TOP 页大小*(页数-1) id FROM table1 ORDER BY id
              )
    ORDER BY id
      

  4.   

    这样可以查出来了,可是在exec的时候还是说找不到这个存储过程,总是有条红线,看着就很不爽
      

  5.   


    create procedure dbo.Sys_IllAll_Pagination
    。。试试这样呢