关于存储过程的并行问题

Salif 2003-03-24 03:26:15
小弟编写了一个存储过程要在C/S架构下运行,代码部分如下,请问如果很多人同时调用这个存储过程,此存储过程是否有缺陷,是否自己要加上封锁机制,如何实现?谢谢!
DECLARE @OfcostUsdp money, @OfcostRmbp money,@OfcostUsdc money,
@CntbgcmUsdp money,@CntbgcmRmbp money

select @OfcostUsdp = 0,@OfcostRmbp = 0,@OfcostUsdc= 0,
@CntbgcmUsdp = 0,@CntbgcmRmbp = 0


DECLARE TY_Cursor CURSOR FOR
select fylb,pc,bb,isnull(sum(zj),0) as sumzj from ys_yf where ly ='X' + @contser
group by fylb,pc,bb

open TY_Cursor

FETCH NEXT FROM TY_Cursor into @fylb,@pc,@bb,@sumzj
while @@fetch_status=0
begin

if @fylb = "f" and @pc= "P" and @bb = "USD"
select @OfcostUsdp=@sumzj
if @fylb = "f" and @pc= "P" and @bb = "RMB"
select @OfcostRmbp=@sumzj
if @fylb = "f" and @pc= "C" and @bb = "USD"
select @OfcostUsdc=@sumzj


if @fylb = "d" and @pc= "P" and @bb = "USD"
select @CntbgcmUsdp=@sumzj
if @fylb = "d" and @pc= "P" and @bb = "RMB"
select @CntbgcmRmbp=@sumzj

FETCH NEXT FROM TY_Cursor into @fylb,@pc,@bb,@sumzj

end

CLOSE TY_Cursor
DEALLOCATE TY_Cursor
...全文
20 点赞 收藏 1
写回复
1 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
tmj 2003-03-26
up
回复
相关推荐
发帖
疑难问题
创建于2007-09-28

2.1w+

社区成员

MS-SQL Server 疑难问题
申请成为版主
帖子事件
创建了帖子
2003-03-24 03:26
社区公告
暂无公告