dbo.LN_cambio_semaforo_email_

Description

Properties

Name Value
ANSI Nulls ON

True

Quoted Identifier ON

True

Encrypted

False

Execute As
Assembly

Parameters

6
Name Data Type Length Description
@accion varchar 20
@cliente int 4
@desde date 3
@hasta date 3
@contraparte int 4
@texto varchar -1

SQL Script

Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
/*
exec [LN_cambio_semaforo_email_] 'select',861672084,'2023-09-25','2023-10-01'
*/

CREATE OR ALTER PROCEDURE dbo.LN_cambio_semaforo_email_
@accion varchar(20) = 'select',
@cliente int = 861672084,
@desde date = null, 
@hasta date = null, 
@contraparte int = null, 
@texto varchar(max) = null


AS


BEGIN
    SET NOCOUNT ON;
 if (@accion = 'select')
 begin
  select cs.cliente, c.nombre_cliente, 
      CONVERT(VARCHAR, cs.fecha, 103) AS fecha_dmy,
      d.contraparte, p.nombre_persona, p.identificacion, cs.texto, 
         isnull(d.email_ejecutivo_cuenta,'soporteled@fidelitas.com.ar') as email
  from LN_cambio_semaforo_email cs 
  inner join clientes c on c.cliente = cs.cliente 
  inner join ln_contrapartes d on d.contraparte = cs.contraparte
  inner join padrones p on p.id_padron = d.id_padron 
  where cs.cliente = @cliente 
  and cs.fecha between @desde and @hasta
  order by  isnull(d.email_ejecutivo_cuenta,'soporteled@fidelitas.com.ar'), cs.fecha, cs.contraparte
 end
 if (@accion = 'insert')
 begin
  insert into LN_cambio_semaforo_email(fecha, cliente, contraparte, texto)
  values (convert(date,getdate()),@cliente,@contraparte,@texto) 
 end
END 

GO

Used By

No items found