dbo.ws_idverification_sociedades

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_sociedades
@pCuit varchar(20),
@cantidad_invalidos int,
@cantidad_validos int

AS
BEGIN
 SET NOCOUNT ON;

SELECT DISTINCT top(@cantidad_validos) padrones.nombre_persona as sociedad,1 as isValid FROM sociedades_directores inner join padrones on sociedades_directores.cuit_sociedad
= padrones.identificacion
 where sociedades_directores.cuit_socio = @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 sociedad,0 as isValid FROM padrones
    WHERE identificacion <> @pCuit /* and id_padron > 10000000 */
 and pre_clave in (30,33) and (ABS(CAST(
    (BINARY_CHECKSUM
    (identificacion, NEWID())) as int))
    % 1000) < 10
    */

ORDER BY sociedad ASC 

END

GO