Description
Properties
| Name | Value |
|---|---|
| ANSI Nulls ON | True |
| Quoted Identifier ON | True |
| Encrypted | False |
| Execute As | |
| Assembly |
SQL Script
Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
CREATE OR ALTER PROCEDURE dbo.sp_temp_padron_sin_empleados
AS
BEGIN
SET NOCOUNT ON;
declare @cuit varchar(20)
DECLARE C_padron CURSOR FOR
select identificacion from temp_padron_sin_empleados
OPEN C_Padron
FETCH NEXT FROM C_Padron INTO @cuit
WHILE @@fetch_status = 0
BEGIN
declare @guardar bit = 0;
if((select count(cuil) from empleados where periodo = '1806' and cuit = @cuit) > 0 )
begin
set @guardar = 1;
update temp_padron_sin_empleados set periodo_1806 = @guardar where identificacion = @cuit
FETCH NEXT FROM C_Padron INTO @cuit
CONTINUE;
end
if((select count(cuil) from empleados where periodo = '1805' and cuit = @cuit) > 0 )
begin
set @guardar = 1;
update temp_padron_sin_empleados set periodo_1805 = @guardar where identificacion = @cuit
FETCH NEXT FROM C_Padron INTO @cuit
CONTINUE;
end
if((select count(cuil) from empleados where cuit = @cuit) > 0 )
begin
set @guardar = 1;
update temp_padron_sin_empleados set nunca = @guardar where identificacion = @cuit
end
FETCH NEXT FROM C_Padron INTO @cuit
END
CLOSE C_Padron
DEALLOCATE C_Padron
END
GO
GO
CREATE OR ALTER PROCEDURE dbo.sp_temp_padron_sin_empleados
AS
BEGIN
SET NOCOUNT ON;
declare @cuit varchar(20)
DECLARE C_padron CURSOR FOR
select identificacion from temp_padron_sin_empleados
OPEN C_Padron
FETCH NEXT FROM C_Padron INTO @cuit
WHILE @@fetch_status = 0
BEGIN
declare @guardar bit = 0;
if((select count(cuil) from empleados where periodo = '1806' and cuit = @cuit) > 0 )
begin
set @guardar = 1;
update temp_padron_sin_empleados set periodo_1806 = @guardar where identificacion = @cuit
FETCH NEXT FROM C_Padron INTO @cuit
CONTINUE;
end
if((select count(cuil) from empleados where periodo = '1805' and cuit = @cuit) > 0 )
begin
set @guardar = 1;
update temp_padron_sin_empleados set periodo_1805 = @guardar where identificacion = @cuit
FETCH NEXT FROM C_Padron INTO @cuit
CONTINUE;
end
if((select count(cuil) from empleados where cuit = @cuit) > 0 )
begin
set @guardar = 1;
update temp_padron_sin_empleados set nunca = @guardar where identificacion = @cuit
end
FETCH NEXT FROM C_Padron INTO @cuit
END
CLOSE C_Padron
DEALLOCATE C_Padron
END
GO
Depends On
2Used By
No items found