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 閱讀(91) 評論(0)  編輯  收藏

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


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

          常用鏈接

          留言簿(5)

          隨筆分類

          隨筆檔案

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 辽中县| 灵宝市| 洛阳市| 辰溪县| 中西区| 麦盖提县| 瑞昌市| 阿拉善左旗| 保靖县| 淳化县| 灵石县| 慈利县| 通江县| 白玉县| 泸水县| 滁州市| 洞头县| 集安市| 原平市| 廊坊市| 双辽市| 罗城| 东光县| 丽江市| 夹江县| 肇庆市| 黑龙江省| 阿勒泰市| 永顺县| 肥乡县| 广宁县| 密云县| 临颍县| 大关县| 东阳市| 浏阳市| 大港区| 定州市| 滦平县| 大兴区| 乳源|