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

推荐订阅源

S
Secure Thoughts
Security Latest
Security Latest
Simon Willison's Weblog
Simon Willison's Weblog
O
OpenAI News
GbyAI
GbyAI
L
LINUX DO - 最新话题
A
Arctic Wolf
T
Tor Project blog
G
GRAHAM CLULEY
I
InfoQ
博客园_首页
IT之家
IT之家
The Register - Security
The Register - Security
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
P
Proofpoint News Feed
The GitHub Blog
The GitHub Blog
Blog — PlanetScale
Blog — PlanetScale
N
Netflix TechBlog - Medium
K
Kaspersky official blog
博客园 - 三生石上(FineUI控件)
S
SegmentFault 最新的问题
U
Unit 42
PCI Perspectives
PCI Perspectives
量子位
P
Palo Alto Networks Blog
S
Securelist
T
Troy Hunt's Blog
博客园 - 【当耐特】
Recorded Future
Recorded Future
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
S
Security Affairs
Engineering at Meta
Engineering at Meta
T
The Blog of Author Tim Ferriss
博客园 - 聂微东
罗磊的独立博客
N
News and Events Feed by Topic
人人都是产品经理
人人都是产品经理
B
Blog RSS Feed
NISL@THU
NISL@THU
C
Cisco Blogs
T
Threatpost
有赞技术团队
有赞技术团队
Forbes - Security
Forbes - Security
Hugging Face - Blog
Hugging Face - Blog
Last Week in AI
Last Week in AI
T
The Exploit Database - CXSecurity.com
Cloudbric
Cloudbric
Cyberwarzone
Cyberwarzone
Google DeepMind News
Google DeepMind News
C
Cyber Attacks, Cyber Crime and Cyber Security

博客园 - 小小点

使用 C# 将数字转换成大写人民币 发个自己写的分页类 计划+日程表+严格执行 今天开始做事 享受过程 明天失踪一天 加班加班 JS模拟类实现 不能连接MySQL数据库的解决办法 解决安装 MSSQL 提示有挂起的安装问题 [转载] ASP中无组件上传文件 PHP读MYSQL中文乱码的解决方法 自己定义的模仿窗体标题栏的控件 意料之中 DHTML文件访问本地数据库[转] 在b/s开发中经常用到的javaScript技术 [转贴] 关机脚本(转载) 离开... 压缩MSSQL数据库日志文件大小
在MSSQL中利用存储过程进行分页查询
小小点 · 2005-11-10 · via 博客园 - 小小点

/***************************************************************************************
功能:
 分页查询数据源

过程名:Pagination_comm

参数: intCurrentPage  当前要查询的页码
 intPageSize 每页显示的记录数
 strTableName 要查询的数据源表名
 strPrimaryKey  该表中对应的主关键(或聚集索引)字段
 strOrder  记录的排序

      Created By HuangQing at 2005-7-15
****************************************************************************************/
CREATE PROCEDURE pagination_comm
(
 @intCurrentPage int,     --页码 
 @intPageSize int,          --每页容纳的记录数
 @strTableName nvarchar (100), -- 表名
 @strPrimaryKey nvarchar (100),  -- 索引字段名
 @intOrder smallint    --排序 0--升序;1--降序
)
AS

Declare @Str nVARCHAR(4000)
Declare @s_Order varchar(5)
Declare @strOrder char(8)

if (@intOrder=0)
   Set @strOrder ='Asc'
if (@intOrder=1)
   Set @strOrder='Desc'

Set @str = 'select Top ' + Cast(@intPageSize as varchar(20)) + '  * From  '+ @strTableName + ' where ('+ @strPrimaryKey +' not in (Select top '+ Cast(@intPageSize*@intCurrentPage as varchar (20)) +'  '+ @strPrimaryKey +'  from '+ @strTableName + ' order by '+ @strPrimaryKey +'  '+ @strOrder +' )) order by '+ @strPrimaryKey +' '+ @strOrder

print @str

EXEC sp_ExecuteSql @Str
GO

当然,我这里查询的时候,其结果是查询出全部字段的内容,在实现工作可根据需要再进行修改。