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

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

          只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


          網(wǎng)站導(dǎo)航:
           

          常用鏈接

          留言簿(5)

          隨筆分類

          隨筆檔案

          搜索

          •  

          最新評(píng)論

          閱讀排行榜

          評(píng)論排行榜

          主站蜘蛛池模板: 东乡县| 邵阳县| 凤凰县| 郁南县| 余干县| 秦安县| 乌兰浩特市| 镇康县| 新蔡县| 浏阳市| 石渠县| 香格里拉县| 长宁区| 民权县| 信丰县| 南丹县| 东源县| 大竹县| 保山市| 临澧县| 苏州市| 兴安盟| 元朗区| 安龙县| 丰城市| 新竹县| 襄樊市| 正镶白旗| 丽江市| 铁岭县| 兴宁市| 临潭县| 诸城市| 论坛| 宿迁市| 富顺县| 谢通门县| 南汇区| 郑州市| 辰溪县| 蒙山县|