create proc ProcSetOpenMonth(@GcompanyUser varchar(120),@months int)
          as
          begin
          declare @PoorNum int
          if exists(select * from Hr_OpenMonth where GcompanyUser=@GcompanyUser)
          begin
          --if(datediff(d,GstartDate,getdate()))
          select @PoorNum=datediff(d,getdate(),dateadd(m,GopenMonth,GstartDate)) from Hr_OpenMonth
          if(@PoorNum>=0)
          begin
          update Hr_OpenMonth set GstartDate=getdate(),GopenMonth=@months+datediff(m,getdate(),dateadd(m,GopenMonth,GstartDate)) where GcompanyUser=@GcompanyUser
          end
          else
          begin
          update Hr_OpenMonth set GstartDate=getdate(),GopenMonth=@months where GcompanyUser=@GcompanyUser
          end
          end
          else
          begin
          insert into Hr_OpenMonth(GcompanyUser,GstartDate,GopenMonth) values(@GcompanyUser,getdate(),@months)
          end
          end
          go

          文章來源:http://www.cnblogs.com/wangdetian168/archive/2008/12/06/1349177.html
          posted on 2010-10-11 09:27 sanmao 閱讀(89) 評論(0)  編輯  收藏

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           

          常用鏈接

          留言簿(5)

          隨筆分類

          隨筆檔案

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 海宁市| 邹城市| 温宿县| 皋兰县| 达尔| 普洱| 辰溪县| 巨野县| 安平县| 东至县| 贵阳市| 庆元县| 汶川县| 华宁县| 卢龙县| 东丰县| 拜泉县| 平泉县| 博白县| 深圳市| 潞西市| 广东省| 西充县| 黄石市| 湖北省| 崇义县| 宽甸| 自治县| 长垣县| 河北区| 乌恰县| 沙洋县| 房产| 长寿区| 鄂托克前旗| 柘城县| 泸水县| 五家渠市| 徐闻县| 镇安县| 西和县|