USP_NAMINGOPPORTUNITY_DELETE
Executes the "Naming 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 USP_NAMINGOPPORTUNITY_DELETE
(
@ID uniqueidentifier,
@CHANGEAGENTID uniqueidentifier
)
as
set nocount on;
declare @CURRENTDATE datetime;
set @CURRENTDATE = getdate();
if @CHANGEAGENTID is null
exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output;
begin try
if exists (select ID from dbo.NAMINGOPPORTUNITYRECOGNITION where NAMINGOPPORTUNITYRECOGNITION.NAMINGOPPORTUNITYID = @ID)
begin
raiserror('This naming opportunity has an associated recognition and cannot be deleted.', 13, 1);
return 0;
end
exec dbo.USP_NAMINGOPPORTUNITY_DELETEBYID_WITHCHANGEAGENTID @ID, @CHANGEAGENTID;
end try
begin catch
exec dbo.USP_RAISE_ERROR;
return 1;
end catch
return 0;