dbo.apikey_cambio_apikey

Description

Properties

Name Value
ANSI Nulls ON

True

Quoted Identifier ON

True

Encrypted

False

Execute As
Assembly

Parameters

3
Name Data Type Length Description
@p_tokenid int 4
@p_apikey varchar 50
@p_userid int 4

SQL Script

Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
/*
update apikey set api_key = '99B59DCFLED79786' where id_api_key = 54  
*/

CREATE OR ALTER PROCEDURE dbo.apikey_cambio_apikey
@p_tokenid int, 
@p_apikey varchar(50) = null, 
@p_userid int = null 

AS

BEGIN
  SET NOCOUNT ON;

  declare @apikey  varchar(50) = null 
  declare @client_id int = null 
  declare @txt varchar(500) = null 
 
  select @apikey = apikey.api_key, 
      @client_id = client_id
    from apikey
   where apikey.id_api_key = @p_tokenid 

   update apikey set api_key = @p_apikey where apikey.id_api_key = @p_tokenid 
   update api_configuracion set apikey = @p_apikey where apikey  = @apikey 

  
  set @txt = 'Se cambio el apikey de: ' + @apikey + ' a ' + @p_apikey
  insert into 
  trazabilidad (cliente,texto,accion,id_plataforma,user_id,created,valor_texto_old,valor_texto_new,doc_id)
  values
  (@client_id,@txt,'API_CAMBIO','API',@p_userid,getdate(),@apikey,@p_apikey,@p_tokenid)
    
END 

GO

Depends On

1

Used By

No items found