Description

Properties

Name Value
ANSI Nulls ON

True

Quoted Identifier ON

True

Encrypted

False

Execute As
Assembly

Parameters

5
Name Data Type Length Description
@p_accion varchar 50
@p_contraparte int 4
@p_gestion int 4
@p_informe int 4
@p_user_id int 4

SQL Script

Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
/* SP IV_Kpi */




CREATE OR ALTER PROCEDURE dbo.IV_Kpi
 @p_accion         varchar(50), /*  'KPI_DAGA_INTERNO'  'KPI_DAGA_EXTERNO' */
 @p_contraparte        int,
 @p_gestion         int,
 @p_informe         int,
 @p_user_id         int

 
AS
BEGIN
 SET NOCOUNT ON;

 /* AGB DECLARAMOS VARIABLES PARA EVITAR PARAMETER SNIFFING EN LA CONFECCIÓN DEL QUERY PLAN */
 DECLARE @V_accion           varchar(50)  = @p_accion
 DECLARE @V_contraparte          int    = @p_contraparte
 DECLARE @V_gestion           int    = @p_gestion
 DECLARE @V_informe           int    = @p_informe
 DECLARE @V_user_id           int    = @p_user_id


 
/*

alter table ln_demo add fin_daga_int datetime null
alter table ln_demo add fin_daga_ext datetime null
alter table ln_demo add uid_daga_int int null
alter table ln_demo add uid_daga_ext int null
*/

 if (@V_accion = 'KPI_DAGA_INTERNO')
 BEGIN
  update LN_DEMO  set fin_daga_int = getdate(),uid_daga_int=@V_user_id where informe = @V_informe and contraparte=@V_contraparte and gestion=@V_gestion 
  return
 END

 if (@V_accion = 'KPI_DAGA_EXTERNO')
 BEGIN
  update LN_DEMO  set fin_daga_ext = getdate(),uid_daga_ext=@V_user_id where informe = @V_informe and contraparte=@V_contraparte and gestion=@V_gestion 
  return
 END

END
GO

Depends On

1

Used By

No items found