USP_WPPARSINGERRORAUDIT_SETDELETEDCHANGEAGENTID

Used to update the audit delete change agent after issuing a standard 'Delete from...' statement on the WPPARSINGERROR table.

Parameters

Parameter Parameter Type Mode Description
@ID uniqueidentifier IN The ID of the record that was deleted.
@CHANGEAGENTID uniqueidentifier IN The ID of the change agent who invoked the delete.

Definition

Copy
/*
Generated by Blackbaud AppFx Platform
Date:  3/21/2017 4:38:57 PM
Assembly Version:  Blackbaud.AppFx.Platform.SqlClr, Version=4.0.167.0, Culture=neutral, PublicKeyToken=null
Copyright Blackbaud
*/
CREATE PROCEDURE dbo.USP_WPPARSINGERRORAUDIT_SETDELETEDCHANGEAGENTID(@ID UNIQUEIDENTIFIER,@CHANGEAGENTID UNIQUEIDENTIFIER)
AS

    /*    
    Since there is no way to explicitly specify a non-default changeagent id via a
     standard 'Delete from ...' statement this SP can be used to change the AUDITCHANGEAGENTID after a deletion.
    */

    set nocount on;

    if  @CHANGEAGENTID is null
    BEGIN
        raiserror ('Unable to update audit delete AUDITCHANGEAGENTID - @CHANGEAGENTID cannot be null', 16,1);
        return 5;
    END

    UPDATE dbo.WPPARSINGERRORAUDIT
    SET AUDITCHANGEAGENTID=@CHANGEAGENTID
    WHERE AUDITRECORDID=@ID
    AND   AUDITTYPECODE= 2; --2 = Before Delete


    if @@error<>0 return -7;

    return 0;