USP_SPONSORSHIPOPPORTUNITY_DELETE
Executes the "Sponsorship Opportunity: 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_SPONSORSHIPOPPORTUNITY_DELETE
(
@ID uniqueidentifier,
@CHANGEAGENTID uniqueidentifier
)
as begin
declare @ISINUSE bit;
select @ISINUSE = case when LOCKCOUNT > 0 OR LOCKED = 1 then 1 else 0 end
from dbo.SPONSORSHIPOPPORTUNITYLOCK
where ID = @ID;
if @ISINUSE = 1
begin
raiserror('BBERR_OPPORTUNITYISINUSE',13,1);
return 1;
end
declare @ISCHILD bit =0
if exists(select ID from dbo.SPONSORSHIPOPPORTUNITYCHILD where ID= @ID)
set @ISCHILD=1
exec USP_SPONSORSHIPOPPORTUNITY_DELETEBYID_WITHCHANGEAGENTID @ID, @CHANGEAGENTID
if @ISCHILD = 1
exec dbo.USP_CONSTITUENT_DELETE @ID, @CHANGEAGENTID
return 0;
end