USP_SIMPLELIST_CAMPAIGNSUBPRIORITY

This list returns all of the subpriorities associated with a campaign.

Parameters

Parameter Parameter Type Mode Description
@CAMPAIGNID uniqueidentifier IN Campaign
@PRIORITYID uniqueidentifier IN Priority
@INCLUDEPRIORITYINLABEL bit IN Include priority in label

Definition

Copy


                CREATE procedure dbo.USP_SIMPLELIST_CAMPAIGNSUBPRIORITY (
                    @CAMPAIGNID uniqueidentifier = null,
                    @PRIORITYID uniqueidentifier = null,
                    @INCLUDEPRIORITYINLABEL bit = 1
                ) as begin

                    select
                        CAMPAIGNSUBPRIORITY.ID [VALUE],
                        case @INCLUDEPRIORITYINLABEL 
                            when 1 then 
                                CAMPAIGNPRIORITYTYPECODE.DESCRIPTION + ' - ' + CAMPAIGNSUBPRIORITYNAMECODE.DESCRIPTION
                            else
                                CAMPAIGNSUBPRIORITYNAMECODE.DESCRIPTION
                            end [LABEL]             
                    from
                        dbo.CAMPAIGNSUBPRIORITY
                    inner join
                        dbo.CAMPAIGNPRIORITY on CAMPAIGNSUBPRIORITY.CAMPAIGNPRIORITYID = CAMPAIGNPRIORITY.ID
                    left outer join
                        dbo.CAMPAIGNPRIORITYTYPECODE on CAMPAIGNPRIORITY.CAMPAIGNPRIORITYTYPECODEID = CAMPAIGNPRIORITYTYPECODE.ID
                    inner join 
                        dbo.CAMPAIGNSUBPRIORITYNAMECODE on CAMPAIGNSUBPRIORITYNAMECODE.ID = CAMPAIGNSUBPRIORITY.CAMPAIGNSUBPRIORITYNAMECODEID
                    where
                        CAMPAIGNPRIORITY.CAMPAIGNID = @CAMPAIGNID
                    and 
                        (@PRIORITYID is null or CAMPAIGNSUBPRIORITY.CAMPAIGNPRIORITYID = @PRIORITYID);            
                end