USP_RELATIONSHIPSBYMARRIAGE_DELETE
Executes the "Relationships By Marriage Delete Record Operation" 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_RELATIONSHIPSBYMARRIAGE_DELETE
(
@ID uniqueidentifier,
@CHANGEAGENTID uniqueidentifier
)
as begin
declare @RELATIONSHIPID uniqueidentifier;
declare RELATIONSHIPCURSOR cursor local fast_forward for
select
RELATIONSHIP.ID
from
dbo.RELATIONSHIP
inner join dbo.RELATIONSHIPBYMARRIAGE
ON RELATIONSHIP.ID = RELATIONSHIPBYMARRIAGE.RELATIONSHIPID
where RECIPROCALCONSTITUENTID = @ID;
open RELATIONSHIPCURSOR;
fetch next from RELATIONSHIPCURSOR into @RELATIONSHIPID;
while (@@FETCH_STATUS = 0)
begin
exec dbo.USP_RELATIONSHIP_DELETE @RELATIONSHIPID, @CHANGEAGENTID;
fetch next from RELATIONSHIPCURSOR into @RELATIONSHIPID;
end
--When a cursor is used, it should be explicitly closed/deallocated in case of blocking or USP running long
close RELATIONSHIPCURSOR;
deallocate RELATIONSHIPCURSOR;
return 0;
end