C#技术百科
问问你的心你有没有信心 做事情要专一坚定,执着
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
posted on 2008-12-06 17:35  王德田  阅读(227)  评论(0编辑  收藏  举报