UFN_EVENT_GETRELATEDEVENTS
Returns the IDs of the event, its ancestors, and its children, enforcing site security.
Return
Return Type |
---|
table |
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@EVENTID | uniqueidentifier | IN |
Definition
Copy
-- site security is enforced via @SINGLEEVENTLIST in calling function/sp
CREATE function dbo.UFN_EVENT_GETRELATEDEVENTS(
@EVENTID uniqueidentifier
)
returns table
as
return
(
select
RELATEDEVENT.ID
from
dbo.EVENTHIERARCHY as RELATEDEVENT
inner join dbo.EVENTHIERARCHY as SOURCEEVENT on SOURCEEVENT.ID = @EVENTID
where
(
RELATEDEVENT.HIERARCHYPATH.IsDescendantOf(SOURCEEVENT.HIERARCHYPATH) = 1
or SOURCEEVENT.HIERARCHYPATH.IsDescendantOf(RELATEDEVENT.HIERARCHYPATH) = 1
)
union
select @EVENTID
);