现在的位置: 首页 > 综合 > 正文

会员开通时间处理的存储过程|软件开发

2012年11月29日 ⁄ 综合 ⁄ 共 670字 ⁄ 字号 评论关闭
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

抱歉!评论已关闭.