USP_DATALIST_PDACCOUNTSEGMENTMAPLISTTASK2

Returns a list of mappable account structure elements.

Parameters

Parameter Parameter Type Mode Description
@ID uniqueidentifier IN Input parameter indicating the context ID for the data list.

Definition

Copy


CREATE procedure dbo.USP_DATALIST_PDACCOUNTSEGMENTMAPLISTTASK2(@ID uniqueidentifier)
as

    set nocount on;
    select 
        ID,
        DESCRIPTION, 
        SEQUENCE
        LENGTH
        case  SEGMENTTYPE when 4 then dbo.UFN_PDCOMPOSITESEGMENT_TABLENAMESTRING(PDACCOUNTSTRUCTURE.PDACCOUNTTABLESAVAILABLEFORSEGMENTID,1)  else (SELECT FRIENDLYTABLENAME FROM DBO.PDACCOUNTTABLESAVAILABLEFORSEGMENT WHERE ID = PDACCOUNTSTRUCTURE.PDACCOUNTTABLESAVAILABLEFORSEGMENTID) end TABLENAME,        
        cast(dbo.UFN_PDACCOUNTSTRUCTURE_ACCOUNTEXISTS2(@ID)as NCHAR(1)) HASACCOUNTS,
        case PDACCOUNTSTRUCTURE.SEGMENTTYPE when 3 then '1' when 4 then '1' else '0' end HASMAPPING,
        SEGMENTTYPE,
        --case  SEGMENTTYPE when 4 then 'Composite' else  'Regular' end SEGMENTTYPEDESCRIPTION,

        SEPARATOR  
    from dbo.PDACCOUNTSTRUCTURE where segmenttype >= 3 and 
    (PDACCOUNTSYSTEMID = @ID or PDACCOUNTSYSTEMID = (select PDACCOUNTSYSTEMID from PDACCOUNTSTRUCTURE where ID = @ID))
    order by sequence