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_empresas
@pCuit varchar(20),
@cantidad_invalidos int,
@cantidad_validos int
AS
BEGIN
SET NOCOUNT ON;
select DISTINCT top(@cantidad_validos) PADRONES.nombre_persona as empresa,1 as isValid from EMPLEADOS INNER JOIN
PADRONES ON EMPLEADOS.CUIT = PADRONES.identificacion
where EMPLEADOS.CUIL = @pCuit
union all
SELECT top(@cantidad_invalidos) PADRONES.nombre_persona as empresa,0 as isValid
FROM padrones
WHERE id_padron in (select top 150 id_padron from padrones
where tipo_persona='J' and (ABS(CAST(
(BINARY_CHECKSUM
(id_padron, NEWID())) as int))
% 100) < 10
)
/*
SELECT top(@cantidad_invalidos) PADRONES.nombre_persona as empresa,0 as isValid FROM padrones
WHERE /* identificacion <> @pCuit and */
substring(identificacion,1,2) in ('30','33')
/* and pre_clave in (30,33) */
and (ABS(CAST(
(BINARY_CHECKSUM
(identificacion, NEWID())) as int))
% 1000) < 100
*/
ORDER BY EMPRESA ASC
END
GO
GO
CREATE OR ALTER PROCEDURE dbo.ws_idverification_empresas
@pCuit varchar(20),
@cantidad_invalidos int,
@cantidad_validos int
AS
BEGIN
SET NOCOUNT ON;
select DISTINCT top(@cantidad_validos) PADRONES.nombre_persona as empresa,1 as isValid from EMPLEADOS INNER JOIN
PADRONES ON EMPLEADOS.CUIT = PADRONES.identificacion
where EMPLEADOS.CUIL = @pCuit
union all
SELECT top(@cantidad_invalidos) PADRONES.nombre_persona as empresa,0 as isValid
FROM padrones
WHERE id_padron in (select top 150 id_padron from padrones
where tipo_persona='J' and (ABS(CAST(
(BINARY_CHECKSUM
(id_padron, NEWID())) as int))
% 100) < 10
)
/*
SELECT top(@cantidad_invalidos) PADRONES.nombre_persona as empresa,0 as isValid FROM padrones
WHERE /* identificacion <> @pCuit and */
substring(identificacion,1,2) in ('30','33')
/* and pre_clave in (30,33) */
and (ABS(CAST(
(BINARY_CHECKSUM
(identificacion, NEWID())) as int))
% 1000) < 100
*/
ORDER BY EMPRESA ASC
END
GO