dbo.copyle_cendeu_nacimiento_defuncion

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.copyle_cendeu_nacimiento_defuncion

AS
BEGIN
    SET NOCOUNT ON;
 declare @fecha_nac date
 declare @fecha_def date
 declare @r_cuit varchar(20)
 
 DECLARE bn2 CURSOR
   FOR
   select distinct identificacion
     from copyle_cuits_2018_06 
       where procesado_nac_def is null         
 OPEN bn2 
 Fetch next from bn2 INTO @r_cuit

 WHILE (@@FETCH_STATUS <> -1 )
 
  BEGIN 
   set @fecha_nac = null
   set @fecha_def = null
   select @fecha_nac = datos_personas.c02_fecha_nac, 
          @fecha_def = datos_personas.fecha_defuncion 
     from datos_personas
     where datos_personas.c01_cuit = @r_cuit
 
   update copyle_cuits_2018_06 
      set fecha_nacimiento = @fecha_nac, 
          fecha_defuncion = @fecha_def, 
       procesado_nac_def = 1 
       where identificacion = @r_cuit

   FETCH next from bn2 INTO @r_cuit
  END
  
 CLOSE bn2
 DEALLOCATE bn2 
END 

GO

Depends On

1

Used By

No items found