dbo.backend_socios

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_socios int 4
@p_Cuit varchar 20
@p_visible bit 1

SQL Script

Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO

CREATE OR ALTER PROCEDURE dbo.backend_socios
@p_id_socios int, -- si viene nulo busca los otros dos campos, si viene con valor solo busca por este id.
@p_Cuit varchar(20),
@p_visible bit

AS
BEGIN
    SET NOCOUNT ON;
 
 if (@p_id_socios is not null) 
    begin
    set @p_cuit = null
    set @p_visible = null
    end  
   
 begin
  select socios.*,
  estado = case socios.visible
   when 1 then 'ACTIVO'
   when 0 then 'INACTIVO' 
  end, 
  cargos.car_nombre, 
  pf.nombre_persona as c01_nombre_soc, 
  pf.cuerpo_clave as dni_socio
  
  from socios
  inner join cargos
  on cargos.car_codigo = socios.car_codigo
  LEFT JOIN padrones AS pf ON (pf.identificacion = c01_cuit_soc) -- info socio

  where (@p_Cuit is not null and
         c01_cuit = @p_Cuit
         and visible = @p_visible)
      
              
     or (@p_id_socios is not null and 
         id_socios = @p_id_socios)

  order by socios.c04_ultimo desc, car_orden asc
 end
END

GO

Used By

No items found