dbo.actualizar_sexo_padrones_renaper

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

AS
BEGIN
    SET NOCOUNT ON;
 declare @cuil varchar(20)
 declare @identificacion varchar(20)
 declare @sexo char(1)
 declare @id_padron bigint 
 declare @cant int = 0

 DECLARE C_padron CURSOR FOR
   select top 1000 a.cuil, p.identificacion, a.sexo, p.id_padron
  from RENAPER_INFO a 
    inner join padrones p 
            on (p.identificacion = a.cuil and p.habilitado = 1 and p.identificador in ('CUIL','CUIT') and isnull(p.sexo,'') not in ('F','f','M','m'))
    where isnull(a.sexo,'') != '' and isnull(a.nroError,'') in ('','0','99') 

 OPEN C_Padron
 FETCH NEXT FROM C_Padron INTO @cuil, @identificacion, @sexo, @id_padron
 WHILE @@fetch_status = 0
  BEGIN
   set @cant = @cant + 1
   update padrones set sexo = @sexo where id_padron = @id_padron
   FETCH NEXT FROM C_Padron INTO @cuil, @identificacion, @sexo, @id_padron
  END
 CLOSE C_Padron
 DEALLOCATE C_Padron
 select @cant as cantidad
END
GO

Used By

No items found