Description
Properties
| Name | Value |
|---|---|
| ANSI Nulls ON | True |
| Quoted Identifier ON | True |
| Encrypted | False |
| Execute As | |
| Assembly |
Parameters
2| Name | Data Type | Length | Description |
|---|---|---|---|
| @cliente | int | 4 | |
| @p_fecha | date | 3 |
SQL Script
Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
/*
exec obtener_novedades_html_mail 2114028260,'2019-01-02'
*/
CREATE OR ALTER PROCEDURE dbo.obtener_novedades_html_mail
@cliente int,
@p_fecha date
AS
BEGIN
SET NOCOUNT ON;
select distinct mr.cuit, p.nombre_persona, isnull(m.observaciones_cliente,'') as observaciones, mr.seccion_mantenimiento, mr.tipo_novedad,
iif(lower(mr.tabla)='cendeu_temp','cendeu',lower(mr.tabla)) as tabla,
mr.html
from monitoreos_resultados as mr
inner join padrones p
on p.identificacion = mr.cuit
inner join monitoreos m
on m.cliente = @cliente
and m.cuit = mr.cuit
and (m.seccion_mantenimiento = mr.seccion_mantenimiento or m.seccion_mantenimiento is null)
and m.visible = 1
and (m.fecha_vigencia_mantenimiento is null or m.fecha_vigencia_mantenimiento > @p_fecha)
where mr.fecha = @p_fecha
and mr.novedad = 1
order by mr.seccion_mantenimiento, iif(lower(mr.tabla)='cendeu_temp','cendeu',lower(mr.tabla)), mr.cuit
END
--select * from productos_secciones
GO
GO
/*
exec obtener_novedades_html_mail 2114028260,'2019-01-02'
*/
CREATE OR ALTER PROCEDURE dbo.obtener_novedades_html_mail
@cliente int,
@p_fecha date
AS
BEGIN
SET NOCOUNT ON;
select distinct mr.cuit, p.nombre_persona, isnull(m.observaciones_cliente,'') as observaciones, mr.seccion_mantenimiento, mr.tipo_novedad,
iif(lower(mr.tabla)='cendeu_temp','cendeu',lower(mr.tabla)) as tabla,
mr.html
from monitoreos_resultados as mr
inner join padrones p
on p.identificacion = mr.cuit
inner join monitoreos m
on m.cliente = @cliente
and m.cuit = mr.cuit
and (m.seccion_mantenimiento = mr.seccion_mantenimiento or m.seccion_mantenimiento is null)
and m.visible = 1
and (m.fecha_vigencia_mantenimiento is null or m.fecha_vigencia_mantenimiento > @p_fecha)
where mr.fecha = @p_fecha
and mr.novedad = 1
order by mr.seccion_mantenimiento, iif(lower(mr.tabla)='cendeu_temp','cendeu',lower(mr.tabla)), mr.cuit
END
--select * from productos_secciones
GO
Depends On
3Used By
No items found