Jody

           

          CREATE PROCEDURE

          CREATE PROCEDURE birdincome_zf
          AS
          declare @actionid integer
          declare @mid varchar(100)
          declare @service_id varchar(100)

          declare? case1??? cursor for?
          ??? SELECT mid,service_id from bird_user_2006_03 where type=0?
          declare? case2??? cursor for?
          ??? SELECT mid,service_id from bird_user_2006_03 where type=1
          ?
          open case1
          ? fetch next from case1 into @mid,@service_id
          ? while (@@fetch_status=0)
          ??? begin
          ??????? select top 1? @actionid=bb.actionid from? operation_temp_0526 as bb
          ?????????????? where bb.serviceid=@service_id and bb.mid=@mid
          ??????? order by bb.id desc

          ???? if (@actionid=1)????????
          ??????? insert into bird_user_2006_04(mid,service_id,type,portal_id) values(@mid,@service_id,'1','10000')
          ???? else
          ???????? print 'ooooooo'?????
          ??????? fetch next from case1 into @mid,@service_id
          ?? end
          deallocate case1

          open case2
          ? fetch next from case2 into @mid,@service_id
          ? while (@@fetch_status=0)
          ??? begin
          ??????? select? top 1 @actionid=bb.actionid from? operation_temp_0526 as bb
          ?????????????? where bb.serviceid=@service_id and bb.mid=@mid
          ??????? order by bb.id desc

          ???? if (@actionid != 2)??????????
          ??????? insert into bird_user_2006_04(mid,service_id,type,portal_id) values(@mid,@service_id,'2','10000')
          ??????? fetch next from case2 into @mid,@service_id
          ?? end
          deallocate case2
          GO

          posted on 2006-05-29 13:24 zhaofei1394 閱讀(640) 評論(0)  編輯  收藏 所屬分類: SQL Server

          導航

          統計

          常用鏈接

          留言簿(1)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          友情鏈接

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 慈利县| 新宁县| 哈密市| 九寨沟县| 伊宁县| 惠来县| 翼城县| 宝兴县| 苏尼特左旗| 抚顺县| 德州市| 昆明市| 陵水| 湖北省| 彭州市| 同心县| 神池县| 运城市| 桦川县| 方山县| 海兴县| 桦甸市| 苗栗县| 时尚| 洱源县| 汶川县| 嵊泗县| 娄烦县| 湘潭市| 榕江县| 抚松县| 通渭县| 堆龙德庆县| 武穴市| 玛曲县| 佳木斯市| 娄底市| 韩城市| 奇台县| 曲阜市| 清苑县|