使用存储过程实现分页打印
来源:互联网 发布:linux system 头文件 编辑:程序博客网 时间:2024/06/05 11:25
使用存储过程实现分页打印。
这个存储过程是一个小区宽带用户管理系统,项目里代码的一部分。
功能是:
实现把表userinfo里的用户资料按IP网段排序进行分页打印!!
比如172.20.128.XX的IP简称为128网段的用户,
172.20.119.XX的IP简称为119网段的用户,
每个网段的用户打印在一张A4纸上,
不足一张的按一张打印,其余的可空出。
大于一张小于两张的按二张打印,其余空出.
经过估算一页最多只能打印37行.
思路是:先把select出的按IP分组的用户信息和计算出的空格行insert进一个临时表中
然后多此临时表打印就行了。
--首先清空表
--truncatetablesubip
declare@resultint
declare@subipvarchar(20)
declarecur_escrollcursorfor
selectsubstring(ip_address,8,3)fromuserinfogroupbysubstring(ip_address,8,3)
opencur_e--打开游标
--print'aaa'+convert(char(13),@@cursor_rows)
fetchfirstfromcur_einto@subip
while(@@fetch_status=0)
begin
--insertintosubip(supip)values(@subip)
insertintosubipselectuserinfo.username,userinfo.catalyst_port,userinfo.home_address,
userinfo.ip_address,userinfo.phone,catalyst.label,'fromuserinfo,
catalystwhereuserinfo.catalyst_id=catalyst.idandsubstring(userinfo.ip_address,8,3)=@subip
set@result=@@rowcount
if(@result>37)
begin
while(@result<74)
begin
insertintosubipselect
username=',catalyst_port=',home_address=',ip_address=',phone=',label=',account='
set@result=@result+1
end
end
else
begin
while(@result<37)
begin
insertintosubipselect
username=',catalyst_port=',home_address=',ip_address=',phone=',label=',account='
set@result=@result+1
end
end
--select@@rowcount
fetchnextfromcur_einto@subip
end
closecur_e
deallocatecur_e
- 使用存储过程实现分页打印
- 使用存储过程实现分页打印
- 使用存储过程实现分页
- 数据库分页处理--使用存储过程实现
- 使用存储过程实现分页效果
- DataList使用存储过程实现分页
- DropDownList使用存储过程实现分页
- oracle中使用存储过程实现分页
- 使用系统存储过程实现的通用分页存储过程
- 使用系统存储过程实现的通用分页存储过程
- 存储过程实现分页
- 存储过程实现分页
- 存储过程实现分页
- 存储过程实现分页
- 使用存储过程分页
- 使用存储过程分页
- 使用存储过程分页
- 存储过程使用:分页存储
- 一道SQL题...(关于树型结构的在关系表中的存储及其应用处理)
- 毕业设计。。。谁来帮帮我。。
- 用自订函数实现功能-------根据指定表名得到表的结构
- sqlplus的一个问题
- DA20 - Data Abstract Adapters
- 使用存储过程实现分页打印
- 不用编写客户端调试WebServices
- SQLServer口令密码对照表
- PowerDesigner11学习点滴 - ★yesjoy★ - BlogJava
- Decryptencryptedstoredprocedures
- (转载)悟透JavaScript
- BuildData-DrivenWebServiceswithUpdatedSupportforSQLServer2000
- ASP中常用Application和Session对象
- web讨论群 32512904