USP_RELATIONSHIPMAPINSTANCE_DELETE
Executes the "Relationship Map Instance: 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. |
@CURRENTAPPUSERID | uniqueidentifier | IN | Input parameter indicating the ID of the current user. |
Definition
Copy
CREATE procedure dbo.USP_RELATIONSHIPMAPINSTANCE_DELETE
(
@ID uniqueidentifier,
@CHANGEAGENTID uniqueidentifier,
@CURRENTAPPUSERID uniqueidentifier = null
)
as begin
declare @ISSYSADMIN bit;
declare @CURRENTOWNERID uniqueidentifier;
declare @CURRENTOTHERSCANMODIFY bit;
if not @CURRENTAPPUSERID is null
begin
select @ISSYSADMIN = dbo.UFN_APPUSER_ISSYSADMIN(@CURRENTAPPUSERID);
if @ISSYSADMIN <> 1
begin
select @CURRENTOWNERID = OWNERID, @CURRENTOTHERSCANMODIFY = OTHERSCANMODIFY from dbo.RELATIONSHIPMAPINSTANCE where ID = @ID;
if @CURRENTOTHERSCANMODIFY = 0 and @CURRENTAPPUSERID <> @CURRENTOWNERID
begin
raiserror('ERR_RELATIONSHIPMAPINSTANCE_NOTOWNER', 13, 1);
end;
end;
end;
-- use the system generated delete routine to allow proper recording of the deleting agent
exec USP_RELATIONSHIPMAPINSTANCE_DELETEBYID_WITHCHANGEAGENTID @ID, @CHANGEAGENTID;
return 0;
end