dbo.backend_abm_cambios_nombres

Description

Properties

Name Value
ANSI Nulls ON

True

Quoted Identifier ON

True

Encrypted

False

Execute As
Assembly

Parameters

7
Name Data Type Length Description
@p_cuit varchar 20
@p_id_padron int 4
@p_usuario varchar 20
@p_nombre varchar 250
@p_fecha date 3
@p_id_cambios int 4
@p_accion char 1

SQL Script

Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO

CREATE OR ALTER PROCEDURE dbo.backend_abm_cambios_nombres

@p_cuit   varchar(20),
@p_id_padron int, 
@p_usuario varchar(20),

@p_nombre varchar(250), 
@p_fecha date, 

@p_id_cambios int,
@p_accion char(1) 

AS
BEGIN
    SET NOCOUNT ON;
 if (@p_fecha = '') begin set @p_fecha = null end 
 set @p_nombre = UPPER(@p_nombre)

    IF @p_accion = 'A'
  begin 
   if (select count(*) from cambios_nombres where cuit = @p_cuit and nombre = @p_nombre) = 0 
    begin
    insert into cambios_nombres(cuit,nombre,fecha,visible,id_padron,created,created_by) 
    values (@p_cuit, 
      @p_nombre, 
      @p_fecha, 
      '1', 
      @p_id_padron, 
      getdate(),
      @p_usuario)
    select '0' as error, 'Alta OK' as mensaje
   end 
   else
   begin
    select '1' as error, 'Alta a registro existente. Ya esta cargado ese Nombre' as mensaje
   end 
  end 

 IF @p_accion = 'M'
  begin 
   update Cambios_Nombres
      set nombre = @p_nombre, 
       fecha = @p_fecha, 
       visible = '1',
       id_padron = @p_id_padron, 
       modified = getdate(),
       modified_by = @p_usuario
    where id_cambios = @p_id_cambios
   select '0' as error, 'Modificación OK' as mensaje
  end 
END 

GO

Depends On

1

Used By

No items found