dbo.sp_REPROCESO_cuit_enrichment

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_REPROCESO_cuit_enrichment

AS
BEGIN
 SET NOCOUNT ON;
 declare @p_Cuit varchar(20)
 declare @empleados_cuit  table (
      hombres decimal(10,2),
    mujeres decimal(10,2),
    total   decimal(10,2),
    fecha   varchar(10))

 declare @cant_empleados int = 0

 DECLARE recorre CURSOR
  FOR
  SELECT distinct cuit FROM procesos_cuit_enrichment 
  where cliente = 7777
  --and cuit = '30500049770'

 OPEN recorre 
 Fetch next from recorre INTO @p_cuit

 WHILE (@@FETCH_STATUS <> -1 )
 BEGIN
  insert into @empleados_cuit
    exec obtener_empleados @p_cuit
  set @cant_empleados = (select total from @empleados_cuit) 
  delete from @empleados_cuit 

  update procesos_cuit_enrichment 
  set cant_empleados = @cant_empleados
  where Cuit =  @p_cuit 
  and cliente = 7777
 
  Fetch next from recorre INTO @p_cuit
 END 
 CLOSE recorre
 DEALLOCATE recorre
END 

GO

Used By

No items found