USP_VOLUNTEERAWARD_DELETE

Executes the "Volunteer Award: Delete" record operation.

Parameters

Parameter Parameter Type Mode Description
@ID uniqueidentifier IN Input parameter indicating the ID of the record being deleted.
@CHANGEAGENTID uniqueidentifier IN Input parameter indicating the ID of the change agent invoking the delete.

Definition

Copy


create procedure dbo.USP_VOLUNTEERAWARD_DELETE
(
    @ID uniqueidentifier,
    @CHANGEAGENTID uniqueidentifier
)
as begin

    if exists(select 1
                from dbo.VOLUNTEERAWARDASSIGNMENT
                where AWARDID = @ID)
    begin
        raiserror('ERR_AWARD_HAS_BEEN_ASSIGNED', 13, 1);
        return 0;
    end

    -- use the system generated delete routine to allow proper recording of the deleting agent

    if @CHANGEAGENTID is null  
        exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output;

    exec USP_VOLUNTEERAWARD_DELETEBYID_WITHCHANGEAGENTID @ID, @CHANGEAGENTID
    return 0;

end