|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?注册
x
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
ALTER proc xxxxx
as
declare @初值 int, @终值 int,@人员编号 int
declare @临时 table (编号 int IDENTITY(1,1),人员编号 int)
insert @临时
select distinct 人员编号 from xxx order by 人员编号
set @初值 = 0
select @终值 = count(*) from @临时
while (@初值 < @终值)
begin
set @初值 = @初值 + 1
select @人员编号 = 人员编号 from @临时 where 编号 = @初值
update xxxx set 发薪次数 = (select count(发薪日期) from xxxx
where 人员编号 = @人员编号) where 编号 = @人员编号
end
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
小弟一直是使用这个格式来进行循环的,不知各位大哥们是怎么使用循环的???? |
|
|
|
|
|
|