dbo.insertar_datos_persona

Description

Properties

Name Value
ANSI Nulls ON

True

Quoted Identifier ON

True

Encrypted

False

Execute As
Assembly

Parameters

2
Name Data Type Length Description
@cuit varchar 20
@fecha_defuncion varchar 50

SQL Script

Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO

CREATE OR ALTER PROCEDURE dbo.insertar_datos_persona
 @cuit varchar(20),
 @fecha_defuncion varchar(50)
AS


BEGIN
    SET NOCOUNT ON;
 
 -- CHANCHADA: AGB - 5/2/2024 Porque es un tax-id extranjero y no queremos que lo pise con los datos de la persona que tiene ese CUIT en argentina
 if @cuit = '20501961869' return

 if ( @fecha_defuncion = '' ) begin set @fecha_defuncion = null end 
 begin 
     if (select COUNT(*) from datos_personas where c01_cuit = @cuit) = 0 
       
     begin 
   insert into datos_personas (c01_cuit,   fecha_defuncion,  created)
                       values (@cuit,     @fecha_defuncion, GETDATE())
  end
  else
  begin
   update datos_personas
      set  
          fecha_defuncion  = @fecha_defuncion, 
       modified         = GETDATE()
   where c01_cuit = @cuit
  end 
 end 

END 

GO

Depends On

1

Used By

No items found