USP_PROGRAMEVENT_DELETE

Executes the "Program Event 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_PROGRAMEVENT_DELETE
                    (
                        @ID uniqueidentifier,
                        @CHANGEAGENTID uniqueidentifier
                    )
                    as begin
                        if exists (select ID from dbo.EVENT where ID = @ID and PROGRAMID is null)
                        begin
                            raiserror('This event cannot be deleted by this action.', 13, 1)

                            return 1
                        end
                        else
                        begin
                            if @CHANGEAGENTID is null  
                                exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output

                            exec USP_EVENT_DELETEBYID_WITHCHANGEAGENTID @ID, @CHANGEAGENTID

                            return 0;
                        end

                    end