zoukankan      html  css  js  c++  java
  • 简单的数据库分页

    1.只需要提供Sql语句和每页的记录数,页数就可以了

    2,速度超快哟,100W记录1~3秒就分出来了

    3,对于存储过程特别好用

    --//调用的方式

    exec up_zbh_DivPageBySql 'select * from 表',10,3

    存储过程

    exec up_zbh_DivPageBySql 'exec 存储过程',10,1

    --//封装成一个存储过程,调用的时候方便的很哈!!

    create procedure up_zbh_DivPageBySql

    @strSql varchar(8000),

    @nPageSize int,

    @nPageCount int

    as

    SET NOCOUNT ON

    DECLARE @P1 INT,

    @nRowCount INT

    --//注意:@scrollopt = 1 会取得Select的时候的总行数

    EXEC sp_cursoropen @P1 OUTPUT, @strSql, @scrollopt = 2, @ccopt = 335873, @rowcount = @nRowCount OUTPUT

    IF (@P1 != 0)

    BEGIN

    --SELECT @nRowCount AS nRecordCount, ceiling(1.0 * @nRowCount / @nPageSize) AS nPageCount, @nPageCount AS nPage

    SET @nPageCount = (@nPageCount - 1) * @nPageSize + 1

    EXEC sp_cursorfetch @P1, 32, @nPageCount, @nPageSize

    EXEC sp_cursorclose @P1

    END

    GO

  • 相关阅读:
    js取当前时间的秒级时间戳
    微信自动聊天脚本
    小程序 缓存过期问题
    去掉表格默认样式
    css3 画心
    数据导入(二):MapReduce
    数据导入(一):Hive On HBase
    HBase参数优化
    Hadoop运维手记
    HBase优化相关
  • 原文地址:https://www.cnblogs.com/lengbingshy/p/1688775.html
Copyright © 2011-2022 走看看