存储过程---实践
来源:互联网 发布:阿里云网站设计 编辑:程序博客网 时间:2024/05/01 08:20
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
1,fgw_proc1:
CREATEPROCEDUREfgw_proc1(@beginint,@endint)
AS
SETNOCOUNTON
DECLARE@useridint,@handledfloat,@totalfloat
CREATETABLE#temp_proc1
(
useridint,
handledfloat,
totalfloat
)
--get@total
DECLAREcur_crCURSORFORSELECTcount(*)FROMAHD.AHD.call_reqwhereopen_date>@beginandopen_date<@end
OPENcur_cr
FETCHcur_crINTO@total
CLOSEcur_cr
DEALLOCATEcur_cr
DECLAREcur_ctctCURSORFORSELECTidFROMAHD.AHD.ctct
OPENcur_ctct
FETCHcur_ctctINTO@userid
WHILE@@FETCH_STATUS=0
BEGIN
--get@handlethroughexecfgw_proc2
EXECfgw_proc2@userid,@begin,@end,@handledoutput
INSERTINTO#temp_proc1VALUES(@userid,@handled,@total)
FETCHNEXTFROMcur_ctctINTO@userid
END
CLOSEcur_ctct
DEALLOCATEcur_ctct
SELECT*FROM#temp_proc1
DROPTABLE#temp_proc1
dropprocedurefgw_proc1
execfgw_proc11,1
2,fgw_proc2
CREATEPROCEDUREfgw_proc2(@useridint,@beginint,@endint,@handledfloatOUTPUT)
AS
SETNOCOUNTON
SET@handled=0
DECLARE@cr_idint,@zh_idint,@statuschar(20),@to_statuschar(20),@cntint,@open_dateint
DECLAREcur_crzhCURSORFORSELECT*FROMAHD.dbo.FGW_CR_ZHwherecnt=@userid
OPENcur_crzh
FETCHcur_crzhINTO@cr_id,@zh_id,@status,@to_status,@cnt,@open_date
WHILE@@FETCH_STATUS=0
BEGIN
DECLARE@count2int
DECLAREcur_crzh2CURSORFORSELECTcount(*)FROMAHD.dbo.FGW_CR_ZHwherecr_id=@cr_idandopen_date>@beginandopen_date<@end
OPENcur_crzh2
FETCHcur_crzh2INTO@count2
CLOSEcur_crzh2
DEALLOCATEcur_crzh2
IF@count2!=0
SET@handled=@handled+1/@count2
FETCHNEXTFROMcur_crzhINTO@cr_id,@zh_id,@status,@to_status,@cnt,@open_date
END
CLOSEcur_crzh
DEALLOCATEcur_crzh
--SELECT@handled
dropprocedurefgw_proc2
execfgw_proc21,1,1
3,fgw_proc3
CREATEPROCEDUREfgw_proc3(@beginint,@endint)
AS
SETNOCOUNTON
DECLARE@cr_idint,@zh_idint,@cntint,@symchar(30),@time_stampint,@isOKint
CREATETABLE#temp_proc3
(
cr_idint,
zh_idint,
cntint,共2页 第1页
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
1,fgw_proc1:
CREATEPROCEDUREfgw_proc1(@beginint,@endint)
AS
SETNOCOUNTON
DECLARE@useridint,@handledfloat,@totalfloat
CREATETABLE#temp_proc1
(
useridint,
handledfloat,
totalfloat
)
--get@total
DECLAREcur_crCURSORFORSELECTcount(*)FROMAHD.AHD.call_reqwhereopen_date>@beginandopen_date<@end
OPENcur_cr
FETCHcur_crINTO@total
CLOSEcur_cr
DEALLOCATEcur_cr
DECLAREcur_ctctCURSORFORSELECTidFROMAHD.AHD.ctct
OPENcur_ctct
FETCHcur_ctctINTO@userid
WHILE@@FETCH_STATUS=0
BEGIN
--get@handlethroughexecfgw_proc2
EXECfgw_proc2@userid,@begin,@end,@handledoutput
INSERTINTO#temp_proc1VALUES(@userid,@handled,@total)
FETCHNEXTFROMcur_ctctINTO@userid
END
CLOSEcur_ctct
DEALLOCATEcur_ctct
SELECT*FROM#temp_proc1
DROPTABLE#temp_proc1
dropprocedurefgw_proc1
execfgw_proc11,1
2,fgw_proc2
CREATEPROCEDUREfgw_proc2(@useridint,@beginint,@endint,@handledfloatOUTPUT)
AS
SETNOCOUNTON
SET@handled=0
DECLARE@cr_idint,@zh_idint,@statuschar(20),@to_statuschar(20),@cntint,@open_dateint
DECLAREcur_crzhCURSORFORSELECT*FROMAHD.dbo.FGW_CR_ZHwherecnt=@userid
OPENcur_crzh
FETCHcur_crzhINTO@cr_id,@zh_id,@status,@to_status,@cnt,@open_date
WHILE@@FETCH_STATUS=0
BEGIN
DECLARE@count2int
DECLAREcur_crzh2CURSORFORSELECTcount(*)FROMAHD.dbo.FGW_CR_ZHwherecr_id=@cr_idandopen_date>@beginandopen_date<@end
OPENcur_crzh2
FETCHcur_crzh2INTO@count2
CLOSEcur_crzh2
DEALLOCATEcur_crzh2
IF@count2!=0
SET@handled=@handled+1/@count2
FETCHNEXTFROMcur_crzhINTO@cr_id,@zh_id,@status,@to_status,@cnt,@open_date
END
CLOSEcur_crzh
DEALLOCATEcur_crzh
--SELECT@handled
dropprocedurefgw_proc2
execfgw_proc21,1,1
3,fgw_proc3
CREATEPROCEDUREfgw_proc3(@beginint,@endint)
AS
SETNOCOUNTON
DECLARE@cr_idint,@zh_idint,@cntint,@symchar(30),@time_stampint,@isOKint
CREATETABLE#temp_proc3
(
cr_idint,
zh_idint,
cntint,共2页 第1页
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
- 存储过程---实践
- 存储过程---实践
- 存储过程实践
- 存储过程(sql-server)---实践
- mysql5存储过程编写实践
- 存储过程之实践期
- DB2 存储过程开发最佳实践
- ASP与存储过程实践(实例)
- DB2 存储过程开发最佳实践
- DB2存储过程开发最佳实践
- C#调用oracle存储过程-实践
- DB2 存储过程开发最佳实践2
- DB2 存储过程开发最佳实践1
- DB2纯SQL存储过程入门实践
- DB2存储过程(纯SQL)实践
- ORACLE 存储过程优化小实践
- DB2 存储过程开发最佳实践
- Oracle存储过程优化小实践
- 互联网应聘出现新航标:找工作流行搜索风
- 如何实现100%的动态数据管道(二)
- vb下将sql中的表导入到excel
- 怎样利用PowerBulider的Datawindow建立中国式的动态报表
- 李开复回应质疑:傻瓜才花钱买没有价值流量
- 存储过程---实践
- 9大数据仓库特点比较
- LETS START FROM HERE...
- windowsserver2003中2000分布式事务错误解决方法
- 标点及其他符号英文单词
- 数据文件丢失之后的恢复
- 利用存储过程得到某一指定的表与其它的表之间的外键关系2000
- 让你在谷歌搜索留下好声誉的五个步骤
- 日志问题普及篇