USP_SALESMETHODDELIVERYMETHOD_DELETE

Executes the "Sales Method Delivery Method 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_SALESMETHODDELIVERYMETHOD_DELETE
        (
            @ID uniqueidentifier,
            @CHANGEAGENTID uniqueidentifier
        )
        as 
            set nocount on;

          declare @ISDEFAULT bit;
          select 
            @ISDEFAULT = ISDEFAULT
          from 
            dbo.SALESMETHODDELIVERYMETHOD
          where 
            ID = @ID;

          if @ISDEFAULT = 1
            begin
              raiserror('BBERR_CONFLICTSEXIST', 13, 1);
                          return 1
            end

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

            exec USP_SALESMETHODDELIVERYMETHOD_DELETEBYID_WITHCHANGEAGENTID @ID, @CHANGEAGENTID
            return 0;