34,590
社区成员
发帖
与我相关
我的任务
分享
ALTER PROCEDURE dbo.月考勤前序
(@ny char(4))
AS
declare @sql varchar(250)
declare @lm varchar(20)
declare c cursor fast_forward for
select lm from 员工调整 where 员工调整.ny = @ny group by lm
open c
fetch next from c into @lm
while @@fetch_status= 0
begin
set @sql = 'update 员工表 set 员工表.' + @lm +' = 员工调整.sz from 员工表 inner join 员工调整 on 员工表.ny =员工调整.ny
and 员工表.xm = 员工调整.xm where 员工表.ny='''+ @ny + ''' and 员工调整.lm='''+convert(varchar(10),@lm)+''' '
exec(@sql)
fetch next from c into @lm
end
close c
deallocate c
ALTER PROCEDURE dbo.月考勤前序
(@ny char(4))
AS
declare @sql varchar(250)
declare @lm varchar(20)
declare c cursor fast_forward for
select lm from 员工调整 where 员工调整.ny = @ny group by lm
open c
fetch next from c into @lm
while @@fetch_status= 0
begin
set @sql = 'update 员工表 set 员工表.' + @lm +' = 员工调整.sz from 员工表 inner join 员工调整 on 员工表.ny =员工调整.ny
and 员工表.xm = 员工调整.xm where 员工表.ny = '+ @ny + ' and 员工调整.lm ='+convert(varchar(10),@lm)
exec(@sql)
fetch next from c into @lm
end
close c
deallocate c