Description
Properties
| Name | Value |
|---|---|
| ANSI Nulls ON | True |
| Quoted Identifier ON | True |
| Encrypted | False |
| Execute As | |
| Assembly |
Parameters
3| Name | Data Type | Length | Description |
|---|---|---|---|
| @tipo_busqueda | varchar | 10 | |
| @p_identificador | varchar | 100 | |
| @max_rows | int | 4 |
SQL Script
Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
-- =============================================
-- Author: Leonel Turchetto
-- Create date: 2019-03-28
-- Description: Búsqueda de Padron
-- =============================================
CREATE OR ALTER PROCEDURE dbo.api_busqueda_padron_completa
@tipo_busqueda varchar(10),
@p_identificador varchar(100),
@max_rows int
AS
BEGIN
SET NOCOUNT ON;
if(@tipo_busqueda = 'CUIT')
begin
SELECT distinct top(@max_rows) identificacion,nombre_persona,iif(tipo_persona='F','FISICA','JURIDICA') AS tipo_persona,sexo
,c02_fecha_nac as fecha_nacimiento,fecha_defuncion,cuerpo_clave,prv_nombre as provincia,loc_nombre as localidad
from dbo.padrones
inner join identificadores on identificadores.identificador = padrones.identificador
left join domicilios_todos on domicilios_todos.cuit = padrones.identificacion and tipo_domicilio = 'F' and visible = 1
left join datos_personas on datos_personas.c01_cuit = padrones.identificacion
WHERE identificacion = @p_identificador and country_code in ('AR') and habilitado = 1
end
else
begin
SELECT distinct top(@max_rows) identificacion,nombre_persona,iif(tipo_persona='F','FISICA','JURIDICA') AS tipo_persona,sexo
,c02_fecha_nac as fecha_nacimiento,fecha_defuncion,cuerpo_clave,prv_nombre as provincia,loc_nombre as localidad
from dbo.padrones
inner join identificadores on identificadores.identificador = padrones.identificador
left join domicilios_todos on domicilios_todos.cuit = padrones.identificacion and tipo_domicilio = 'F' and visible = 1
left join datos_personas on datos_personas.c01_cuit = padrones.identificacion
WHERE CONTAINS((nombre_persona),@p_identificador) and country_code in ('AR') and habilitado = 1
end
END
GO
GO
-- =============================================
-- Author: Leonel Turchetto
-- Create date: 2019-03-28
-- Description: Búsqueda de Padron
-- =============================================
CREATE OR ALTER PROCEDURE dbo.api_busqueda_padron_completa
@tipo_busqueda varchar(10),
@p_identificador varchar(100),
@max_rows int
AS
BEGIN
SET NOCOUNT ON;
if(@tipo_busqueda = 'CUIT')
begin
SELECT distinct top(@max_rows) identificacion,nombre_persona,iif(tipo_persona='F','FISICA','JURIDICA') AS tipo_persona,sexo
,c02_fecha_nac as fecha_nacimiento,fecha_defuncion,cuerpo_clave,prv_nombre as provincia,loc_nombre as localidad
from dbo.padrones
inner join identificadores on identificadores.identificador = padrones.identificador
left join domicilios_todos on domicilios_todos.cuit = padrones.identificacion and tipo_domicilio = 'F' and visible = 1
left join datos_personas on datos_personas.c01_cuit = padrones.identificacion
WHERE identificacion = @p_identificador and country_code in ('AR') and habilitado = 1
end
else
begin
SELECT distinct top(@max_rows) identificacion,nombre_persona,iif(tipo_persona='F','FISICA','JURIDICA') AS tipo_persona,sexo
,c02_fecha_nac as fecha_nacimiento,fecha_defuncion,cuerpo_clave,prv_nombre as provincia,loc_nombre as localidad
from dbo.padrones
inner join identificadores on identificadores.identificador = padrones.identificador
left join domicilios_todos on domicilios_todos.cuit = padrones.identificacion and tipo_domicilio = 'F' and visible = 1
left join datos_personas on datos_personas.c01_cuit = padrones.identificacion
WHERE CONTAINS((nombre_persona),@p_identificador) and country_code in ('AR') and habilitado = 1
end
END
GO
Used By
No items found