USP_SIMPLEDATALIST_PDACCOUNTSYSTEM_SITES

List of all sites in the system that have not been assigned to an Account System, and the user can interact with.

Parameters

Parameter Parameter Type Mode Description
@ACCOUNTSYSTEMID uniqueidentifier IN ACCOUNTSYSTEMID
@CURRENTAPPUSERID uniqueidentifier IN Input parameter indicating the ID of the current user.

Definition

Copy


    CREATE procedure dbo.USP_SIMPLEDATALIST_PDACCOUNTSYSTEM_SITES(@ACCOUNTSYSTEMID uniqueidentifier, @CURRENTAPPUSERID uniqueidentifier)
    as
    set nocount on;

    -- Revisit add Site Security

    --     inner join dbo.UFN_SITESFORUSER(@CURRENTAPPUSERID) AS SFU ON SFU.SITEID=SITE.ID


    select 
        SITE.[ID] as VALUE
        SITE.[NAME] as LABEL 

    from dbo.SITE 
    inner join dbo.UFN_SITESFORUSER(@CURRENTAPPUSERID) as SFU on SFU.SITEID = SITE.ID
    where SITE.ID not in (Select SITEID from dbo.PDACCOUNTSYSTEMSITE where PDACCOUNTSYSTEMID <> IsNull(@ACCOUNTSYSTEMID, '00000000-0000-0000-0000-000000000000'))

    order by SITE.[NAME];