dbo.ws_idverification_domicilios

Description

Properties

Name Value
ANSI Nulls ON

True

Quoted Identifier ON

True

Encrypted

False

Execute As
Assembly

Parameters

3
Name Data Type Length Description
@pCuit varchar 20
@cantidad_invalidos int 4
@cantidad_validos int 4

SQL Script

Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
CREATE OR ALTER PROCEDURE dbo.ws_idverification_domicilios
@pCuit varchar(20),
@cantidad_invalidos int,
@cantidad_validos int
AS
BEGIN

SET NOCOUNT ON;

select distinct top(@cantidad_validos) DOMICILIO + ' ' + LOC_NOMBRE + ' ' + prv_nombre AS domicilio,1 as isValid from domicilios_todos 
where CUIT = @pCuit and domicilio is not null and loc_nombre is not null and prv_nombre is not null
union all
select DISTINCT TOP(@cantidad_invalidos) DOMICILIO + ' ' + LOC_NOMBRE + ' ' + prv_nombre AS domicilio,0 as isValid from domicilios_todos 
where domicilio <> '' /* AND tipo_domicilio = 'E' */ and prv_nombre <> '' AND loc_nombre <> '' and domicilio is not null and loc_nombre is not null and prv_nombre is not null AND cuit in (
select top 15 identificacion from padrones
  where tipo_persona='F' and (ABS(CAST(
  (BINARY_CHECKSUM
  (identificacion, NEWID())) as int))
  % 100) < 10
  )
/*
SELECT top 15 identificacion as cuit FROM padrones
  WHERE identificacion <> @pCuit /* and tipo_persona = 'F' and id_padron > 10000000 */
 
  /*and pre_clave in (20,23,24,27) */

  and substring(identificacion,1,2) in ('20','23','24','27')
  and (ABS(CAST(
  (BINARY_CHECKSUM
  (identificacion, NEWID())) as int))
  % 1000) < 100)
  */

order by domicilio asc

/*
UNION ALL
select DISTINCT EntidadesBancarias.nombre, 1 as isValid,'BANCOS' AS grupo from CENDEU INNER JOIN
EntidadesBancarias ON CONVERT(INT,CENDEU.CODIGO_ENT) = EntidadesBancarias.cod_banco
where CENDEU.IDEN = @pCuit 
union all
select DISTINCT TOP 5 EntidadesBancarias.nombre, 0 as isValid,'BANCOS' AS grupo from 
EntidadesBancarias WHERE cod_banco NOT IN (
select DISTINCT EntidadesBancarias.cod_banco from CENDEU INNER JOIN
EntidadesBancarias ON CONVERT(INT,CENDEU.CODIGO_ENT) = EntidadesBancarias.cod_banco
where CENDEU.IDEN = @pCuit )
*/




END

GO