dbo.busqueda_padron_201910

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_identificador varchar 100
@p_todos_los_paises tinyint 1
@p_tipo_persona char 1

SQL Script

Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
-- =============================================
-- Author: Leonel Turchetto
-- Create date: 2019-10-18
-- Description: Búsqueda de Padron Avanzado
-- =============================================
CREATE OR ALTER PROCEDURE dbo.busqueda_padron_201910
@p_identificador varchar(100),
@p_todos_los_paises tinyint,
@p_tipo_persona char(1) = null
AS
BEGIN
 SET NOCOUNT ON;
 if(@p_todos_los_paises = 1)
  begin
   if(@p_tipo_persona is not null)
   begin
    SELECT top 200  identificacion,pre_clave, suf_clave,cuerpo_clave,nombre_persona,padrones.identificador,id_padron,identificadores.identificador,tipo_persona  from dbo.padrones  inner join identificadores on
    identificadores.identificador = padrones.identificador
    WHERE CONTAINS((nombre_persona,identificacion,cuerpo_clave),@p_identificador) and habilitado = 1 and tipo_persona = @p_tipo_persona
   end
   else
   begin
    SELECT top 200  identificacion,pre_clave, suf_clave,cuerpo_clave,nombre_persona,padrones.identificador,id_padron,identificadores.identificador,tipo_persona  from dbo.padrones  inner join identificadores on
    identificadores.identificador = padrones.identificador
    WHERE CONTAINS((nombre_persona,identificacion,cuerpo_clave),@p_identificador) and habilitado = 1
   end
  end

 else
  begin
   if(@p_tipo_persona is not null)
   begin
    SELECT top 200  identificacion,pre_clave, suf_clave,cuerpo_clave,nombre_persona,padrones.identificador,id_padron,identificadores.identificador,tipo_persona  from dbo.padrones  inner join identificadores on
   identificadores.identificador = padrones.identificador
   WHERE CONTAINS((nombre_persona,identificacion,cuerpo_clave),@p_identificador) and country_code in ('AR') and habilitado = 1 and tipo_persona = @p_tipo_persona
   end
   else
   begin
    SELECT top 200  identificacion,pre_clave, suf_clave,cuerpo_clave,nombre_persona,padrones.identificador,id_padron,identificadores.identificador,tipo_persona  from dbo.padrones  inner join identificadores on
   identificadores.identificador = padrones.identificador
   WHERE CONTAINS((nombre_persona,identificacion,cuerpo_clave),@p_identificador) and country_code in ('AR') and habilitado = 1
   end
   
  end   
  
END

GO

Used By

No items found