USP_CORRESPONDENCECODE_DELETE
Executes the "Correspondence Code: 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_CORRESPONDENCECODE_DELETE
(
@ID uniqueidentifier,
@CHANGEAGENTID uniqueidentifier
)
as
set nocount on;
if exists (select ID from dbo.CORRESPONDENCEPROCESS where CORRESPONDENCECODEID = @ID)
begin
raiserror('This correspondence code is being used by a correspondence process and cannot be deleted.',13,1);
return 0;
end
if exists (select ID from dbo.CONSTITUENTCORRESPONDENCE where CORRESPONDENCECODEID = @ID)
begin
raiserror('This correspondence code has been assigned to a constituent and cannot be deleted.',13,1);
return 0;
end
exec dbo.USP_CORRESPONDENCECODE_DELETEBYID_WITHCHANGEAGENTID @ID, @CHANGEAGENTID;
return 0;