UFN_SITES_MAPFROM_CAMPAIGNID

Maps a CAMPAIGNID to a SITEID.

Return

Return Type
table

Parameters

Parameter Parameter Type Mode Description
@CAMPAIGNID uniqueidentifier IN

Definition

Copy


            create function dbo.UFN_SITES_MAPFROM_CAMPAIGNID
            (
                @CAMPAIGNID uniqueidentifier
            )
            returns @SITES table (SITEID uniqueidentifier)
            as
            begin
                insert into @SITES(SITEID)
                    select 
                        SITEID
                    from 
                        dbo.CAMPAIGNSITE
                    where 
                        CAMPAIGNSITE.CAMPAIGNID = @CAMPAIGNID

                if (select count(SITEID) from @SITES) = 0
                    /*No site has been defined for this record.  Return null to allow access to user granted access to records with no site assignment*/
                    insert into @SITES(SITEID) values (null)                    

                return
            end