dbo.obtener_novedades

Description

Properties

Name Value
ANSI Nulls ON

True

Quoted Identifier ON

True

Encrypted

False

Execute As
Assembly

Parameters

1
Name Data Type Length Description
@yesterday date 3

SQL Script

Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
--[obtener_novedades] '2024-12-30'
CREATE OR ALTER PROCEDURE dbo.obtener_novedades 
@yesterday date = null

AS
BEGIN
 
    SET NOCOUNT ON;
 if (@yesterday is null) begin set @yesterday = GETDATE() - 1 end 
 

 /*
  select distinct cuit, lower(tipo_novedad) as seccion, id_cendeu as id, nro_cheque 
    from monitoreos_resultados 
   where novedad = 1 
     and id_cendeu IS NOT NULL 
     and convert(date, fecha) = @yesterday
  union 
  select distinct cuit, lower(tipo_novedad) as seccion, id_juicio as id, nro_cheque 
      from monitoreos_resultados 
    where novedad = 1 
      and id_juicio IS NOT NULL 
  and convert(date, fecha) = @yesterday
  union 
  select distinct cuit, lower(tipo_novedad) as seccion, id_cheque as id, nro_cheque 
    from monitoreos_resultados 
    where novedad = 1  
      and id_cheque IS NOT NULL 
  and convert(date, fecha) = @yesterday
  */


 select distinct cuit, lower(tipo_novedad) as seccion, lower(tabla) as tabla, id_tabla as id, nro_cheque 
     from monitoreos_resultados 
   where novedad = 1 
     and id_tabla IS NOT NULL 
  and convert(date, fecha) = @yesterday
  --and LOWER(tabla) = 'juicios'
  and tabla != 'cendeu_temp'
  and tipo_novedad not in ('socios','clae') --> porque estas ya tienen su html guardado
  order by lower(tabla) desc, cuit
END

GO

Used By

No items found