--select * from estadistica_caf
declare @idcafMin int
declare @idcafMax int
declare @inicial bigint
declare @final bigint
set @idcafMin = 0
set @idcafMax = 0
select @idcafMin = MIN(idcaf_activo) from estadistica_caf --group by idcaf_activo order by idcaf_activo desc
select @idcafMax = MAX(idcaf_activo) from estadistica_caf
--print @idcafMin
--print @idcafMAX
declare @idcafExist int
set @idcafExist = 0
while @idcafMin <= @idcafMax
begin -- inicio while
set @idcafExist = 0
select @idcafExist = idcaf_activo from estadistica_caf where idcaf_activo=@idcafMin
print @idcafExist
if @idcafExist = 0
begin
set @idcafMin = @idcafMin + 1
print 'continue'
continue
end
else
begin
select @inicial = inicial from estadistica_caf where idcaf_activo=@idcafMin
print @inicial
select @final = final from estadistica_caf where idcaf_activo=@idcafMin
print @final
--print 'procesar caf'
end
--end
--print 'x'
set @idcafMin = @idcafMin + 1
end -- fin while
--while (select COUNT(*) from estadistica_caf) > 0
--begin
--continue
--end
No hay comentarios.:
Publicar un comentario