USP_OPPORTUNITYAMOUNTBRACKETGROUP_DELETE

Executes the "Opportunity Amount Brackets Group: 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_OPPORTUNITYAMOUNTBRACKETGROUP_DELETE
(
    @ID uniqueidentifier,
    @CHANGEAGENTID uniqueidentifier
)
as begin

        -- delete all sites and amounty ranges for this group


        declare @CONTEXTCACHE varbinary(128);
        set @CONTEXTCACHE = CONTEXT_INFO();
        if @CHANGEAGENTID is not null
            set CONTEXT_INFO @CHANGEAGENTID

    delete from dbo.OPPORTUNITYAMOUNTBRACKET
    where OPPORTUNITYBRACKETGROUPID = @ID

    delete from dbo.OPPORTUNITYAMOUNTBRACKETSITES
    where OPPORTUNITYAMOUNTBRACKETGROUPID = @ID

        -- restore cached context

        if not @CONTEXTCACHE is null
            set CONTEXT_INFO @CONTEXTCACHE

    exec USP_OPPORTUNITYAMOUNTBRACKETGROUP_DELETEBYID_WITHCHANGEAGENTID @ID, @CHANGEAGENTID
    return 0;

end