dbo.obtener_Tipo_Persona

Description

Properties

Name Value
ANSI Nulls ON

True

Quoted Identifier ON

True

Encrypted

False

Execute As
Assembly

Parameters

2
Name Data Type Length Description
@cuit varchar 50
@id_padron int 4

SQL Script

Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO

-- [obtener_Tipo_Persona] '27208925658'
-- exec obtener_tipo_persona '800970721'

CREATE OR ALTER PROCEDURE dbo.obtener_Tipo_Persona
@cuit varchar(50), 
@id_padron int = null 
AS
BEGIN
    SET NOCOUNT ON;

 if (@id_padron is not null) 
  select top 1 tipo_persona, nombre_persona, identificadores.country_code, upper(country.country_name) as nacionalidad
  from padrones
  inner join identificadores on identificadores.identificador = padrones.identificador
  left join country on country.country_code = identificadores.country_code
  where id_padron =  @id_padron  
  and habilitado = 1 

 else 

  select top 1 tipo_persona, nombre_persona, identificadores.country_code, upper(country.country_name) as nacionalidad
  from padrones
  inner join identificadores on identificadores.identificador = padrones.identificador
  left join country on country.country_code = identificadores.country_code
  where identificacion =  @cuit 
  and habilitado = 1 
  order by tipo_persona desc 



END 

GO

Used By

No items found