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 | |
| @p_pais | varchar | 10 |
SQL Script
Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
/*
exec [LN_NOMBRE_PERSONA] 1,'AR'
*/
create OR ALTER PROCEDURE dbo.LN_NOMBRE_PERSONA
@p_cuit varchar(20),
@p_pais varchar(10)
AS
BEGIN
SET NOCOUNT ON;
declare @nrodoc char(8) = ''
if (@p_pais = 'AR' and len(@p_cuit) <= 8)
begin
set @nrodoc = right('00000000'+@p_cuit,8)
end
if (select count(*) from padrones
inner join identificadores on identificadores.identificador = padrones.identificador
where (padrones.identificacion = @p_cuit or padrones.cuerpo_clave = @nrodoc or padrones.cuerpo_clave = @p_cuit)
and identificadores.country_code = @p_pais
and padrones.habilitado = 1) = 1
begin
select nombre_persona
from padrones
inner join identificadores on identificadores.identificador = padrones.identificador
where (padrones.identificacion = @p_cuit or padrones.cuerpo_clave = @nrodoc or padrones.cuerpo_clave = @p_cuit)
and identificadores.country_code = @p_pais
and padrones.habilitado = 1
end
END
GO
GO
/*
exec [LN_NOMBRE_PERSONA] 1,'AR'
*/
create OR ALTER PROCEDURE dbo.LN_NOMBRE_PERSONA
@p_cuit varchar(20),
@p_pais varchar(10)
AS
BEGIN
SET NOCOUNT ON;
declare @nrodoc char(8) = ''
if (@p_pais = 'AR' and len(@p_cuit) <= 8)
begin
set @nrodoc = right('00000000'+@p_cuit,8)
end
if (select count(*) from padrones
inner join identificadores on identificadores.identificador = padrones.identificador
where (padrones.identificacion = @p_cuit or padrones.cuerpo_clave = @nrodoc or padrones.cuerpo_clave = @p_cuit)
and identificadores.country_code = @p_pais
and padrones.habilitado = 1) = 1
begin
select nombre_persona
from padrones
inner join identificadores on identificadores.identificador = padrones.identificador
where (padrones.identificacion = @p_cuit or padrones.cuerpo_clave = @nrodoc or padrones.cuerpo_clave = @p_cuit)
and identificadores.country_code = @p_pais
and padrones.habilitado = 1
end
END
GO
Depends On
2Used By
No items found