Description
Properties
| Name | Value |
|---|---|
| ANSI Nulls ON | True |
| Quoted Identifier ON | True |
| Encrypted | False |
| Execute As | |
| Assembly |
Parameters
2| Name | Data Type | Length | Description |
|---|---|---|---|
| @p_cuit | varchar | 20 | |
| @tipo_persona | char | 1 |
SQL Script
Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
CREATE OR ALTER PROCEDURE dbo.obtener_card_vinculaciones
@p_cuit varchar(20),
@tipo_persona char(1)
AS
BEGIN
SET NOCOUNT ON;
/*select top 7 nombre_persona from vinculaciones right join tipo_vinculaciones on
id_tipo_vinculacion = cod_vinculacion INNER JOIN PADRONES ON PADRONES.identificacion = cuit_vinculada where cuit_sociedad = @p_cuit and visible = 1
*/
select top 7 * from vinculaciones
right join tipo_vinculaciones on id_tipo_vinculacion = cod_vinculacion
INNER JOIN PADRONES ON PADRONES.identificacion = cuit_vinculada
where cuit_sociedad = @p_cuit
and visible = 1
and PADRONES.tipo_persona = tipo_persona
and id_tipo_vinculacion < 20
union
select top 7 * from vinculaciones
right join tipo_vinculaciones on id_tipo_vinculacion = cod_vinculacion
INNER JOIN PADRONES ON PADRONES.identificacion = cuit_sociedad
where cuit_vinculada = @p_cuit
and visible = 1
and PADRONES.tipo_persona = tipo_persona
and id_tipo_vinculacion < 20
END
GO
GO
CREATE OR ALTER PROCEDURE dbo.obtener_card_vinculaciones
@p_cuit varchar(20),
@tipo_persona char(1)
AS
BEGIN
SET NOCOUNT ON;
/*select top 7 nombre_persona from vinculaciones right join tipo_vinculaciones on
id_tipo_vinculacion = cod_vinculacion INNER JOIN PADRONES ON PADRONES.identificacion = cuit_vinculada where cuit_sociedad = @p_cuit and visible = 1
*/
select top 7 * from vinculaciones
right join tipo_vinculaciones on id_tipo_vinculacion = cod_vinculacion
INNER JOIN PADRONES ON PADRONES.identificacion = cuit_vinculada
where cuit_sociedad = @p_cuit
and visible = 1
and PADRONES.tipo_persona = tipo_persona
and id_tipo_vinculacion < 20
union
select top 7 * from vinculaciones
right join tipo_vinculaciones on id_tipo_vinculacion = cod_vinculacion
INNER JOIN PADRONES ON PADRONES.identificacion = cuit_sociedad
where cuit_vinculada = @p_cuit
and visible = 1
and PADRONES.tipo_persona = tipo_persona
and id_tipo_vinculacion < 20
END
GO
Depends On
3Used By
No items found