USP_DATALIST_SPONSORSHIPLOCATIONISDESCENDANT

Datalist that returns a 1 if a location is a descendant of another location, 0 otherwise

Parameters

Parameter Parameter Type Mode Description
@PREVIOUSLOCATIONID uniqueidentifier IN
@CURRENTLOCATIONID uniqueidentifier IN

Definition

Copy


create procedure dbo.USP_DATALIST_SPONSORSHIPLOCATIONISDESCENDANT(
  @PREVIOUSLOCATIONID uniqueidentifier= null,
  @CURRENTLOCATIONID uniqueidentifier = null)
as
    set nocount on;

    select ID,
         NAME,
         HIERARCHYPATH.IsDescendantOf((select HIERARCHYPATH 
                                         from dbo.SPONSORSHIPLOCATION 
                                        where ID = @CURRENTLOCATIONID)) as ISDESCENDANT
      from dbo.SPONSORSHIPLOCATION
     where ID = @PREVIOUSLOCATIONID