dbo.obtener_empleado_de_ant

Description

Properties

Name Value
ANSI Nulls ON

True

Quoted Identifier ON

True

Encrypted

False

Execute As
Assembly

Parameters

1
Name Data Type Length Description
@p_Cuit varchar 20

SQL Script

Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
/*Esto es parte de tab Formales*/
CREATE OR ALTER PROCEDURE dbo.obtener_empleado_de_ant
@p_Cuit varchar(20)
AS


BEGIN
    SET NOCOUNT ON;
 declare @periodo date 
  set @periodo = (select max(fuentes_procesadas.fecha_informacion) from fuentes_procesadas where fuente = 'empleados')
 select  @periodo as ultimo_periodo_procesado, empleados.cuit as cuit_empleador, pf.nombre_persona as nombre_empleador, substring(convert(char,@periodo),6,2)  +'/20' + substring(convert(char,@periodo),3,2) as periodo
   from empleados
   left join padrones AS pf ON (pf.identificacion = cuit)
  where cuil = @p_Cuit
    and visible = '1'
    and periodo =  convert(int,substring(convert(char,@periodo),3,2)+substring(convert(char,@periodo),6,2))
  GROUP BY empleados.cuit, pf.nombre_persona
       order by 3 desc   
 
END

GO

Used By

No items found