惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Latest news
Latest news
J
Java Code Geeks
The Register - Security
The Register - Security
V
Visual Studio Blog
IT之家
IT之家
Martin Fowler
Martin Fowler
The GitHub Blog
The GitHub Blog
B
Blog RSS Feed
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Stack Overflow Blog
Stack Overflow Blog
The Cloudflare Blog
N
Netflix TechBlog - Medium
博客园 - 聂微东
D
Docker
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园_首页
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
C
Check Point Blog
美团技术团队
爱范儿
爱范儿
A
About on SuperTechFans
Y
Y Combinator Blog
Engineering at Meta
Engineering at Meta
PCI Perspectives
PCI Perspectives
MyScale Blog
MyScale Blog
T
Threatpost
S
Securelist
量子位
C
Cyber Attacks, Cyber Crime and Cyber Security
Vercel News
Vercel News
宝玉的分享
宝玉的分享
Project Zero
Project Zero
S
Security @ Cisco Blogs
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Cisco Talos Blog
Cisco Talos Blog
罗磊的独立博客
M
MIT News - Artificial intelligence
雷峰网
雷峰网
G
Google Developers Blog
T
The Blog of Author Tim Ferriss
Google Online Security Blog
Google Online Security Blog
The Last Watchdog
The Last Watchdog
P
Proofpoint News Feed
Security Archives - TechRepublic
Security Archives - TechRepublic
Schneier on Security
Schneier on Security
H
Hacker News: Front Page
T
Troy Hunt's Blog
U
Unit 42
Scott Helme
Scott Helme

博客园 - loway

必须掌握的八个DOS命令 [转] asp免费源代码 ASP 中 Split 函数的实例 - loway ASP:Recordset对象方法 ASP错误编码大全 实用网页代码 - loway - 博客园 ASP各种存储过程使用指南 - loway - 博客园 纯ASP上传图像文件到数据库的最佳例子 - loway - 博客园 禁止右键、选择、粘贴、shift、ctrl、alt..... - loway - 博客园 弹出式说明窗口---JavaScript的使用 asp之fso操作大全代码奉送 JS的正则表达式 在ASP中轻松实现记录集分页显示 ASP开发中存储过程应用全接触 数据库设计 正则表达式语法 水晶报表参数编程示例代码 经典水晶报表设计——国际销售合同! .NET环境下水晶报表使用总结
翻页的存储过程
loway · 2006-05-15 · via 博客园 - loway

CREATE PROC Turnpage
    @qCols varchar(200),                --需要查询的列
    @qTables         varchar(200),       --需要查询的表 和条件
    @iKey         varchar (20),       --标识字段
    @oKey        varchar(20),        --排序字段
    @pageSize         int,                 --每页的行数
    @pageNumber       int                   --要显示的页码, 从0开始
AS
set nocount on
BEGIN
    DECLARE @sqlText AS varchar(1000)
    DECLARE @sqlTable AS varchar(1000)
    SET @sqlTable = 'SELECT TOP ' + CAST((@pageNumber + 1) * @pageSize AS varchar(30)) + ' ' + @qCols +' from '+ @qTables + ' order by '+@oKey+ ' desc'
    SET @sqlText =
        'SELECT TOP ' + CAST(@pageSize AS varchar(30)) + ' * ' +
        'FROM (' + @sqlTable + ') AS tableA ' +
        'WHERE ' + @iKey + ' NOT IN(SELECT TOP ' +
        CAST(@pageNumber * @pageSize AS varchar(30)) + ' ' + @iKey +
        ' FROM (' + @sqlTable + ') AS tableB)'
  EXEC (@sqlText)
 --print(@sqltext)
END
GO