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)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          友情鏈接

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 桂阳县| 高安市| 原阳县| 区。| 荥经县| 望奎县| 丰顺县| 古交市| 原阳县| 鄂尔多斯市| 巴彦淖尔市| 滕州市| 东方市| 特克斯县| 图们市| 海南省| 沅陵县| 安义县| 密山市| 浑源县| 芦溪县| 和顺县| 六盘水市| 盐边县| 普兰店市| 江华| 昭平县| 深州市| 汶川县| 五大连池市| 中西区| 高唐县| 开江县| 金塔县| 威海市| 沙洋县| 田阳县| 东源县| 昂仁县| 永德县| 八宿县|