Description
Properties
| Name | Value |
|---|---|
| ANSI Nulls ON | True |
| Quoted Identifier ON | True |
| Encrypted | False |
| Execute As | |
| Assembly |
Parameters
5| Name | Data Type | Length | Description |
|---|---|---|---|
| @p_cuit | varchar | 52 | |
| @p_dni | varchar | 52 | |
| @p_nombre | varchar | 182 | |
| @p_domicilio | varchar | 152 | |
| @p_razon_social | varchar | 152 |
SQL Script
Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
-- =============================================
-- Author: <Samuel Gonzalez>
-- Create date: <28 Jul 2017>
-- Description: <Buscador padrón personalizado,
-- busca cuits en padrón por:
-- (domicilio y nombre) o por (nombre) o por (dni) o por (cuit)
-- >
-- =============================================
CREATE OR ALTER PROCEDURE dbo.backend_busqueda_padron_personalizada
-- Add the parameters for the stored procedure here
@p_cuit varchar(52),
@p_dni varchar(52),
@p_nombre varchar(182),
@p_domicilio varchar(152),
@p_razon_social varchar(152)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
if (@p_domicilio is not null) and (@p_domicilio != '') and (@p_razon_social is not null) and (@p_razon_social != '')
begin
select TOP 10 p.identificacion as cuit, p.nombre_persona, p.id_padron from padrones p
inner join domicilios_todos d on (p.identificacion = d.cuit)
where (nombre_persona LIKE '%'+@p_razon_social+'%') and (domicilio = @p_domicilio)
/*
select distinct cuit from domicilios_todos
where
(cuit in (select identificacion from padrones where (CONTAINS(nombre_persona, @p_razon_social))))
and (domicilio = @p_domicilio)
*/
end
else if (@p_razon_social is not null) and (@p_razon_social != '')
begin
select TOP 10 identificacion as cuit, nombre_persona, id_padron from padrones wherE contains(nombre_persona,@p_razon_social)
end
else if (@p_domicilio is not null) and (@p_domicilio != '') and (@p_nombre is not null) and (@p_nombre != '')
begin
select TOP 10 p.identificacion as cuit, p.nombre_persona, p.id_padron from padrones p
inner join domicilios_todos d on (p.identificacion = d.cuit)
where (p.nombre_persona = @p_nombre) and (domicilio = @p_domicilio)
/*
select distinct cuit from domicilios_todos
where
(cuit in (select identificacion from padrones where (nombre_persona = @p_nombre)))
and (domicilio = @p_domicilio)
*/
end
else if (@p_nombre is not null) and (@p_nombre != '')
begin
select TOP 10 identificacion as cuit, nombre_persona, id_padron from padrones where (nombre_persona = @p_nombre)
end
else if (@p_dni is not null) and (@p_dni != '')
begin
select TOP 10 identificacion as cuit, nombre_persona, id_padron from padrones where (cuerpo_clave = @p_dni)
end
else if (@p_cuit is not null) and (@p_cuit != '')
begin
select TOP 10 identificacion as cuit, nombre_persona, id_padron from padrones where (identificacion = @p_cuit)
end
END
GO
GO
-- =============================================
-- Author: <Samuel Gonzalez>
-- Create date: <28 Jul 2017>
-- Description: <Buscador padrón personalizado,
-- busca cuits en padrón por:
-- (domicilio y nombre) o por (nombre) o por (dni) o por (cuit)
-- >
-- =============================================
CREATE OR ALTER PROCEDURE dbo.backend_busqueda_padron_personalizada
-- Add the parameters for the stored procedure here
@p_cuit varchar(52),
@p_dni varchar(52),
@p_nombre varchar(182),
@p_domicilio varchar(152),
@p_razon_social varchar(152)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
if (@p_domicilio is not null) and (@p_domicilio != '') and (@p_razon_social is not null) and (@p_razon_social != '')
begin
select TOP 10 p.identificacion as cuit, p.nombre_persona, p.id_padron from padrones p
inner join domicilios_todos d on (p.identificacion = d.cuit)
where (nombre_persona LIKE '%'+@p_razon_social+'%') and (domicilio = @p_domicilio)
/*
select distinct cuit from domicilios_todos
where
(cuit in (select identificacion from padrones where (CONTAINS(nombre_persona, @p_razon_social))))
and (domicilio = @p_domicilio)
*/
end
else if (@p_razon_social is not null) and (@p_razon_social != '')
begin
select TOP 10 identificacion as cuit, nombre_persona, id_padron from padrones wherE contains(nombre_persona,@p_razon_social)
end
else if (@p_domicilio is not null) and (@p_domicilio != '') and (@p_nombre is not null) and (@p_nombre != '')
begin
select TOP 10 p.identificacion as cuit, p.nombre_persona, p.id_padron from padrones p
inner join domicilios_todos d on (p.identificacion = d.cuit)
where (p.nombre_persona = @p_nombre) and (domicilio = @p_domicilio)
/*
select distinct cuit from domicilios_todos
where
(cuit in (select identificacion from padrones where (nombre_persona = @p_nombre)))
and (domicilio = @p_domicilio)
*/
end
else if (@p_nombre is not null) and (@p_nombre != '')
begin
select TOP 10 identificacion as cuit, nombre_persona, id_padron from padrones where (nombre_persona = @p_nombre)
end
else if (@p_dni is not null) and (@p_dni != '')
begin
select TOP 10 identificacion as cuit, nombre_persona, id_padron from padrones where (cuerpo_clave = @p_dni)
end
else if (@p_cuit is not null) and (@p_cuit != '')
begin
select TOP 10 identificacion as cuit, nombre_persona, id_padron from padrones where (identificacion = @p_cuit)
end
END
GO
Depends On
2Used By
No items found