USP_TRIBUTELETTERCODE_DELETE

Executes the "Tribute Letter: 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_TRIBUTELETTERCODE_DELETE
                    (
                        @ID uniqueidentifier,
                        @CHANGEAGENTID uniqueidentifier
                    )
                    as 
                        set nocount on;

                        if (select count(ID) from dbo.TRIBUTEACKNOWLEDGEMENTPROCESS where TRIBUTELETTERCODEID = @ID) > 0
                        begin
                            raiserror('This tribute letter is being used by a tribute acknowledgement process and cannot be deleted.',13,1);
                            return 0;
                        end

                        if (select count(ID) from dbo.REVENUETRIBUTELETTER where TRIBUTELETTERCODEID = @ID) > 0
                        begin
                            raiserror('This tribute letter has been assigned and cannot be deleted.',13,1);
                            return 0;
                        end

                        exec dbo.USP_TRIBUTELETTERCODE_DELETEBYID_WITHCHANGEAGENTID @ID, @CHANGEAGENTID;
                        return 0;