dbo.backend_cambios_nombres

Description

Properties

Name Value
ANSI Nulls ON

True

Quoted Identifier ON

True

Encrypted

False

Execute As
Assembly

Parameters

3
Name Data Type Length Description
@p_id_cambios int 4
@p_Cuit varchar 20
@p_visible bit 1

SQL Script

Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
--exec [backend_cambios_nombres] null,'20248728745',1
-- select * from cambios_nombres where cuit = '33501880049'
CREATE OR ALTER PROCEDURE dbo.backend_cambios_nombres 
@p_id_cambios int, 
@p_Cuit varchar(20),
@p_visible bit 

AS
BEGIN
    SET NOCOUNT ON;
 if (@p_id_cambios is not null)
   begin
  select  id_cambios,
    cuit,
    id_padron,
    nombre,
    fecha,
    fecha_dmy = convert(varchar(10),fecha,103),
    visible,
  estado = case cambios_nombres.visible
   when 0 then 'INACTIVO' 
   else 'ACTIVO'
  end
  
  from cambios_nombres
    
  where id_cambios = @p_id_cambios
         
  order by fecha
   end
 else
 begin
  if (@p_cuit is not null and @p_visible is null) 
    begin
   select  id_cambios,
     cuit,
     id_padron,
     nombre,
     fecha,
     fecha_dmy = convert(varchar(10),fecha,103),
     visible,
   estado = case cambios_nombres.visible
   when 0 then 'INACTIVO' 
   else 'ACTIVO'
   end
  
   from cambios_nombres
    
   where cuit = @p_cuit
         
   order by fecha
    end

    if (@p_cuit is not null and @p_visible is not null) 
    begin
   select  id_cambios,
     cuit,
     id_padron,
     nombre,
     fecha,
     fecha_dmy = convert(varchar(10),fecha,103),
     visible,
   estado = case cambios_nombres.visible
   when 0 then 'INACTIVO' 
   else 'ACTIVO'
   end
  
   from cambios_nombres
    
   where cuit = @p_cuit and isnull(visible,1) = @p_visible 
         
   order by fecha
    end
 end 
END

GO

Depends On

1

Used By

No items found