• Sqlserver2005 with as 实现分页以提高性能


    1。在sqlserver中建一个存储过程,代码如下:


    create proc GetRows
    @begin as int,
    @end as int
    as
    begin
       
    with result as
       (
         
    select row_number() over(order by book_id descas rowindex,book_name,price from book
       )
     
    select * from result where rowindex between @begin and @end
    end

    通过with as 以提高性能,配合AspnetPager控件来实现分页,适合sql2005。

    在sql2000中可以这样写


    create proc GetRows2
    @begin as int,
    @end as int
    as
    begin
       
    declare @table as table (rowindex  int identity(1,1),bookName  varchar(50),price  money)
       
    insert into @table select book_name,price from book order by book_id
       
    select * from @table where rowindex between @begin and @end 
    end
  • 相关阅读:
    gotour源码阅读
    CPU知识
    GCC知识
    go/src/make.bash阅读
    Go的pprof使用
    CGI的一些知识点
    STM32——C语言数据类型
    css 学习资料
    项目管理实践教程
    js 格式验证总结
  • 原文地址:https://www.cnblogs.com/aaa6818162/p/1531341.html
Copyright © 2020-2023  润新知