dbo.LN_ic_historico_pdf_

Description

Properties

Name Value
ANSI Nulls ON

True

Quoted Identifier ON

True

Encrypted

False

Execute As
Assembly

Parameters

4
Name Data Type Length Description
@p_action varchar 10
@p_contraparte int 4
@p_gestion int 4
@p_userid int 4

SQL Script

Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO

/*
exec [LN_ic_historico_pdf_] 'INSERTAR',4,8,'305555',22
exec [LN_ic_historico_pdf_] 'LISTAR',4
*/


CREATE OR ALTER PROCEDURE dbo.LN_ic_historico_pdf_ 
 @p_action varchar(10), 
 @p_contraparte int, 
 @p_gestion int = null, 
 @p_userid int = null
 
AS
BEGIN
 /*
 
  select * from LN_ic_historico_pdf 
  alter table LN_ic_historico_pdf 
  sp: ln_pdfs_
 
  */

 SET @p_action = UPPER(@p_action)

 SET NOCOUNT ON;
 if (@p_action = 'INSERTAR')
 BEGIN
  INSERT INTO LN_ic_historico_pdf (contraparte,gestion,user_id,created,created_by)
  VALUES (@p_contraparte,@p_gestion,@p_userid,getdate(),@p_userid)
  select @@IDENTITY as pdfid
 END



 if (@p_action = 'LISTAR')
 BEGIN
  if (@p_gestion is not null)
   select pdf_id as id, 
   contraparte as contraparte, 
   gestion as gestion, 
   created as fecha, 
   convert(varchar,created,103) as fecha_dmy,
   users.username,
   users.user_id
   from LN_ic_historico_pdf inner join users on LN_ic_historico_pdf.user_id=users.user_id  
   where contraparte = @p_contraparte
   and gestion =  @p_gestion 
   order by created,gestion
  else
   select pdf_id as id, 
   contraparte as contraparte, 
   gestion as gestion, 
   created as fecha, 
   convert(varchar,created,103) as fecha_dmy,
   users.username,
   users.user_id
   from LN_ic_historico_pdf inner join users on LN_ic_historico_pdf.user_id=users.user_id  
   where contraparte = @p_contraparte
   order by created,gestion
 END
       

END

GO

Used By

No items found