日期:2014-05-18 浏览次数:21765 次
ALTER PROC P2_OneKeyMergeTreasure( @roleID int )AS BEGIN declare @count int; select @count=count(1) from T2_RoleTrea where roleid=@roleID and placeType=1 if(@count<=1)begin return; end declare @srcID int; declare @destID int; declare @tmpID int; select top 1 @srcID=id from T2_RoleTrea where roleid=618 and placeType=1 order by id; declare mycurosr cursor for select id from T2_RoleTrea where roleid=618 and placeType=1 and id!=@srcID order by id; open mycursor fetch next from mycursor into @destID while @@fetch_status=0 begin exec P2_MergeTreasure @srcID,@destID,@tmpID out; set @srcID=@tmpID; fetch next from mycursor into @destID end close mycursor deallocate mycursor END